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:
parent
b5a79264a1
commit
e845bebc6f
4
CHANGES
4
CHANGES
@ -1,5 +1,9 @@
|
||||
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.
|
||||
- FLUID now recognizes the "using" keyword in
|
||||
declarations.
|
||||
|
@ -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.
|
||||
//
|
||||
@ -572,6 +572,13 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load
|
||||
snprintf(filename, sizeof(filename), "%s/%s", directory_,
|
||||
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))
|
||||
{
|
||||
char name[1024]; // Temporary directory name
|
||||
@ -581,6 +588,7 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load
|
||||
num_dirs ++;
|
||||
insert(num_dirs, name, Fl_File_Icon::find(filename));
|
||||
}
|
||||
#endif // WIN32 && !__CYGWIN__
|
||||
else if (filetype_ == FILES &&
|
||||
fl_filename_match(files[i]->d_name, pattern_))
|
||||
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 $".
|
||||
//
|
||||
|
@ -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).
|
||||
*
|
||||
@ -65,8 +65,12 @@ int scandir(const char *dirname, struct dirent ***namelist,
|
||||
return nDir;
|
||||
}
|
||||
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);
|
||||
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
// Append a trailing slash to directory names...
|
||||
strcat(selectDir->d_name, "/");
|
||||
}
|
||||
if (!select || (*select)(selectDir)) {
|
||||
if (nDir==NDir) {
|
||||
struct dirent **tempDir = calloc(sizeof(struct dirent*), NDir+33);
|
||||
@ -104,5 +108,5 @@ int alphasort (struct dirent **a, struct dirent **b) {
|
||||
#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 $".
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user