diff options
| author | Manolo Gouy <Manolo> | 2016-10-19 08:31:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-10-19 08:31:48 +0000 |
| commit | ec41e1a59b74d8dff34ae5ce1fbf3fdbd34ab240 (patch) | |
| tree | ef3dc601ab1608c0e2018f8b7053e7307401164a /src/drivers | |
| parent | 43c98c7c90a311ed7e5e71f6924aa81f4eb847a4 (diff) | |
Make sure "/" is always in the list of file systems reported by Fl_File_Chooser (Unix/Linux platform)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12049 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index bea584c11..d25573d31 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -300,10 +300,18 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, // FILE *mtab; // /etc/mtab or /etc/mnttab file char line[FL_PATH_MAX]; // Input line - + + // Every Unix has a root filesystem '/'. + // This ensures that the user don't get an empty + // window after requesting filesystem list. + browser->add("/", icon); + num_files ++; + // // Open the file that contains a list of mounted filesystems... // + // Note: this misses automounted filesystems on FreeBSD if absent from /etc/fstab + // mtab = fopen("/etc/mnttab", "r"); // Fairly standard if (mtab == NULL) @@ -321,11 +329,11 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, continue; if (sscanf(line, "%*s%4095s", filename) != 1) continue; + if (strcmp("/", filename) == 0) + continue; // "/" was added before // Add a trailing slash (except for the root filesystem) - if (strcmp("/", filename) != 0) { - strlcat(filename, "/", sizeof(filename)); - } + strlcat(filename, "/", sizeof(filename)); // printf("Fl_File_Browser::load() - adding \"%s\" to list...\n", filename); browser->add(filename, icon); @@ -333,11 +341,6 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, } fclose(mtab); - } else { - // Every Unix has a root filesystem '/'. - // This last stage fallback ensures that the user don't get an empty - // window after requesting filesystem list. - browser->add("/", icon); } #endif // _AIX || ... return num_files; |
