mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
Modify WIN32 scandir() function so that directories get a trailing
slash. Modify Fl_File_Browser::load() to check for trailing slash on WIN32. This should fix performance problems when loading large remote directories. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2130 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
CHANGES IN FLTK 1.1.0rc1
|
CHANGES IN FLTK 1.1.0rc1
|
||||||
|
|
||||||
|
- Now append trailing slash to directory names in names
|
||||||
|
in WIN32 version of scandir(). This takes care of a
|
||||||
|
file chooser performance problem with large
|
||||||
|
directories.
|
||||||
- Added Fl_Preferences class from Matthias Melcher.
|
- Added Fl_Preferences class from Matthias Melcher.
|
||||||
- FLUID now recognizes the "using" keyword in
|
- FLUID now recognizes the "using" keyword in
|
||||||
declarations.
|
declarations.
|
||||||
|
|||||||
+10
-2
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_File_Browser.cxx,v 1.1.2.10 2002/04/16 14:50:10 easysw Exp $"
|
// "$Id: Fl_File_Browser.cxx,v 1.1.2.11 2002/04/29 19:40:51 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Fl_File_Browser routines.
|
// Fl_File_Browser routines.
|
||||||
//
|
//
|
||||||
@@ -572,6 +572,13 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load
|
|||||||
snprintf(filename, sizeof(filename), "%s/%s", directory_,
|
snprintf(filename, sizeof(filename), "%s/%s", directory_,
|
||||||
files[i]->d_name);
|
files[i]->d_name);
|
||||||
|
|
||||||
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
|
if (files[i].d_name[strlen(files[i].d_name) - 1] == '/')
|
||||||
|
{
|
||||||
|
num_dirs ++;
|
||||||
|
insert(num_dirs, files[i].d_name, Fl_File_Icon::find(filename));
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (fl_filename_isdir(filename))
|
if (fl_filename_isdir(filename))
|
||||||
{
|
{
|
||||||
char name[1024]; // Temporary directory name
|
char name[1024]; // Temporary directory name
|
||||||
@@ -581,6 +588,7 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load
|
|||||||
num_dirs ++;
|
num_dirs ++;
|
||||||
insert(num_dirs, name, Fl_File_Icon::find(filename));
|
insert(num_dirs, name, Fl_File_Icon::find(filename));
|
||||||
}
|
}
|
||||||
|
#endif // WIN32 && !__CYGWIN__
|
||||||
else if (filetype_ == FILES &&
|
else if (filetype_ == FILES &&
|
||||||
fl_filename_match(files[i]->d_name, pattern_))
|
fl_filename_match(files[i]->d_name, pattern_))
|
||||||
add(files[i]->d_name, Fl_File_Icon::find(filename));
|
add(files[i]->d_name, Fl_File_Icon::find(filename));
|
||||||
@@ -615,5 +623,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.10 2002/04/16 14:50:10 easysw Exp $".
|
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.11 2002/04/29 19:40:51 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
+7
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* "$Id: scandir_win32.c,v 1.11.2.4.2.2 2002/01/01 15:11:32 easysw Exp $"
|
* "$Id: scandir_win32.c,v 1.11.2.4.2.3 2002/04/29 19:40:51 easysw Exp $"
|
||||||
*
|
*
|
||||||
* WIN32 scandir function for the Fast Light Tool Kit (FLTK).
|
* WIN32 scandir function for the Fast Light Tool Kit (FLTK).
|
||||||
*
|
*
|
||||||
@@ -65,8 +65,12 @@ int scandir(const char *dirname, struct dirent ***namelist,
|
|||||||
return nDir;
|
return nDir;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
selectDir=(struct dirent*)malloc(sizeof(struct dirent)+strlen(find.cFileName));
|
selectDir=(struct dirent*)malloc(sizeof(struct dirent)+strlen(find.cFileName)+1);
|
||||||
strcpy(selectDir->d_name, find.cFileName);
|
strcpy(selectDir->d_name, find.cFileName);
|
||||||
|
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
// Append a trailing slash to directory names...
|
||||||
|
strcat(selectDir->d_name, "/");
|
||||||
|
}
|
||||||
if (!select || (*select)(selectDir)) {
|
if (!select || (*select)(selectDir)) {
|
||||||
if (nDir==NDir) {
|
if (nDir==NDir) {
|
||||||
struct dirent **tempDir = calloc(sizeof(struct dirent*), NDir+33);
|
struct dirent **tempDir = calloc(sizeof(struct dirent*), NDir+33);
|
||||||
@@ -104,5 +108,5 @@ int alphasort (struct dirent **a, struct dirent **b) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End of "$Id: scandir_win32.c,v 1.11.2.4.2.2 2002/01/01 15:11:32 easysw Exp $".
|
* End of "$Id: scandir_win32.c,v 1.11.2.4.2.3 2002/04/29 19:40:51 easysw Exp $".
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user