From e845bebc6f240ea957756667b72a2d5abddde102 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 29 Apr 2002 19:40:51 +0000 Subject: 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 --- src/scandir_win32.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/scandir_win32.c') diff --git a/src/scandir_win32.c b/src/scandir_win32.c index 9df92a4d5..acfe24b35 100644 --- a/src/scandir_win32.c +++ b/src/scandir_win32.c @@ -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 $". */ -- cgit v1.2.3