mirror of
https://github.com/fltk/fltk.git
synced 2026-05-24 08:16:04 +08:00
Rename fl_filename_isdir_quick to _fl_filename_isdir_quick, do not
export it, and add comments to indicate that it is a private API we do not support outside of FLTK. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5635 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+10
-1
@@ -40,7 +40,6 @@ FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
|
||||
FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
|
||||
FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
|
||||
FL_EXPORT int fl_filename_isdir(const char *name);
|
||||
FL_EXPORT int fl_filename_isdir_quick(const char *name);
|
||||
|
||||
# ifdef __cplusplus
|
||||
/*
|
||||
@@ -120,6 +119,16 @@ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
|
||||
|
||||
FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
|
||||
int msglen = 0);
|
||||
|
||||
/*
|
||||
* _fl_filename_isdir_quick() is a private function that checks for a
|
||||
* trailing slash and assumes that the passed name is a directory if
|
||||
* it finds one. This function is used by Fl_File_Browser and
|
||||
* Fl_File_Chooser to avoid extra stat() calls, but is not supported
|
||||
* outside of FLTK...
|
||||
*/
|
||||
int _fl_filename_isdir_quick(const char *name);
|
||||
|
||||
# endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
|
||||
@@ -600,7 +600,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
|
||||
|
||||
icon = Fl_File_Icon::find(filename);
|
||||
if ((icon && icon->type() == Fl_File_Icon::DIRECTORY) ||
|
||||
fl_filename_isdir_quick(filename)) {
|
||||
_fl_filename_isdir_quick(filename)) {
|
||||
num_dirs ++;
|
||||
insert(num_dirs, files[i]->d_name, icon);
|
||||
} else if (filetype_ == FILES &&
|
||||
|
||||
@@ -412,9 +412,9 @@ Fl_File_Chooser::fileListCB()
|
||||
if (Fl::event_clicks()) {
|
||||
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||
if ((strlen(pathname) == 2 && pathname[1] == ':') ||
|
||||
fl_filename_isdir_quick(pathname))
|
||||
_fl_filename_isdir_quick(pathname))
|
||||
#else
|
||||
if (fl_filename_isdir_quick(pathname))
|
||||
if (_fl_filename_isdir_quick(pathname))
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
{
|
||||
// Change directories...
|
||||
@@ -477,7 +477,7 @@ Fl_File_Chooser::fileListCB()
|
||||
if (callback_) (*callback_)(this, data_);
|
||||
|
||||
// Activate the OK button as needed...
|
||||
if (!fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY))
|
||||
if (!_fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY))
|
||||
okButton->activate();
|
||||
else
|
||||
okButton->deactivate();
|
||||
@@ -544,15 +544,15 @@ Fl_File_Chooser::fileNameCB()
|
||||
// Enter pressed - select or change directory...
|
||||
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||
if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) ||
|
||||
fl_filename_isdir_quick(pathname) &&
|
||||
_fl_filename_isdir_quick(pathname) &&
|
||||
compare_dirnames(pathname, directory_)) {
|
||||
#else
|
||||
if (fl_filename_isdir_quick(pathname) &&
|
||||
if (_fl_filename_isdir_quick(pathname) &&
|
||||
compare_dirnames(pathname, directory_)) {
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
directory(pathname);
|
||||
} else if ((type_ & CREATE) || access(pathname, 0) == 0) {
|
||||
if (!fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
|
||||
if (!_fl_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
|
||||
// Update the preview box...
|
||||
update_preview();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ static inline int isdirsep(char c) {return c=='/' || c=='\\';}
|
||||
#define isdirsep(c) ((c)=='/')
|
||||
#endif
|
||||
|
||||
int fl_filename_isdir_quick(const char* n) {
|
||||
int _fl_filename_isdir_quick(const char* n) {
|
||||
// Do a quick optimization for filenames with a trailing slash...
|
||||
if (*n && isdirsep(n[strlen(n) - 1])) return 1;
|
||||
return fl_filename_isdir(n);
|
||||
|
||||
Reference in New Issue
Block a user