|
|
@ -1,5 +1,5 @@ |
|
|
|
//
|
|
|
|
//
|
|
|
|
// "$Id: Fl_File_Browser.cxx,v 1.1.2.8 2002/03/29 14:16:03 easysw Exp $"
|
|
|
|
// "$Id: Fl_File_Browser.cxx,v 1.1.2.9 2002/04/14 12:51:55 easysw Exp $"
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Fl_File_Browser routines.
|
|
|
|
// Fl_File_Browser routines.
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -44,10 +44,12 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include "flstring.h" |
|
|
|
#include "flstring.h" |
|
|
|
|
|
|
|
|
|
|
|
#if defined(WIN32) && ! defined(__CYGWIN__) |
|
|
|
#ifdef __CYGWIN__ |
|
|
|
|
|
|
|
# include <mntent.h> |
|
|
|
|
|
|
|
#elif defined(WIN32) |
|
|
|
# include <windows.h> |
|
|
|
# include <windows.h> |
|
|
|
# include <direct.h> |
|
|
|
# include <direct.h> |
|
|
|
#endif /* WIN32 */ |
|
|
|
#endif /* __CYGWIN__ */ |
|
|
|
|
|
|
|
|
|
|
|
#if defined(__EMX__) |
|
|
|
#if defined(__EMX__) |
|
|
|
# define INCL_DOS |
|
|
|
# define INCL_DOS |
|
|
@ -409,9 +411,26 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load |
|
|
|
if ((icon = Fl_File_Icon::find("any", Fl_File_Icon::DEVICE)) == NULL) |
|
|
|
if ((icon = Fl_File_Icon::find("any", Fl_File_Icon::DEVICE)) == NULL) |
|
|
|
icon = Fl_File_Icon::find("any", Fl_File_Icon::DIRECTORY); |
|
|
|
icon = Fl_File_Icon::find("any", Fl_File_Icon::DIRECTORY); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(WIN32) && ! defined (__CYGWIN__) |
|
|
|
#ifdef WIN32 |
|
|
|
DWORD drives; // Drive available bits
|
|
|
|
# ifdef __CYGWIN__ |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Cygwin provides an implementation of setmntent() to get the list
|
|
|
|
|
|
|
|
// of available drives...
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
FILE *m = setmntent("/-not-used-", "r"); |
|
|
|
|
|
|
|
struct mntent *p; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ((p = getmntent (m)) != NULL) { |
|
|
|
|
|
|
|
add(p->mnt_dir, icon); |
|
|
|
|
|
|
|
num_files ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endmntent(m); |
|
|
|
|
|
|
|
# else |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Normal WIN32 code uses drive bits...
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
DWORD drives; // Drive available bits
|
|
|
|
|
|
|
|
|
|
|
|
drives = GetLogicalDrives(); |
|
|
|
drives = GetLogicalDrives(); |
|
|
|
for (i = 'A'; i <= 'Z'; i ++, drives >>= 1) |
|
|
|
for (i = 'A'; i <= 'Z'; i ++, drives >>= 1) |
|
|
@ -426,7 +445,11 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load |
|
|
|
|
|
|
|
|
|
|
|
num_files ++; |
|
|
|
num_files ++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# endif // __CYGWIN__
|
|
|
|
#elif defined(__EMX__) |
|
|
|
#elif defined(__EMX__) |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// OS/2 code uses drive bits...
|
|
|
|
|
|
|
|
//
|
|
|
|
ULONG curdrive; // Current drive
|
|
|
|
ULONG curdrive; // Current drive
|
|
|
|
ULONG drives; // Drive available bits
|
|
|
|
ULONG drives; // Drive available bits
|
|
|
|
int start = 3; // 'C' (MRS - dunno if this is correct!)
|
|
|
|
int start = 3; // 'C' (MRS - dunno if this is correct!)
|
|
|
@ -443,22 +466,23 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load |
|
|
|
num_files ++; |
|
|
|
num_files ++; |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// UNIX code uses /etc/fstab or similar...
|
|
|
|
|
|
|
|
//
|
|
|
|
FILE *mtab; // /etc/mtab or /etc/mnttab file
|
|
|
|
FILE *mtab; // /etc/mtab or /etc/mnttab file
|
|
|
|
char line[1024]; // Input line
|
|
|
|
char line[1024]; // Input line
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Open the file that contains a list of mounted filesystems...
|
|
|
|
// Open the file that contains a list of mounted filesystems...
|
|
|
|
//
|
|
|
|
//
|
|
|
|
# if defined(hpux) || defined(__sun) |
|
|
|
|
|
|
|
mtab = fopen("/etc/mnttab", "r"); // Fairly standard
|
|
|
|
mtab = fopen("/etc/mnttab", "r"); // Fairly standard
|
|
|
|
# elif defined(__sgi) || defined(linux) |
|
|
|
if (mtab == NULL) |
|
|
|
mtab = fopen("/etc/mtab", "r"); // More standard
|
|
|
|
mtab = fopen("/etc/mtab", "r"); // More standard
|
|
|
|
# else |
|
|
|
if (mtab == NULL) |
|
|
|
mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list
|
|
|
|
mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list
|
|
|
|
if (mtab == NULL) |
|
|
|
if (mtab == NULL) |
|
|
|
mtab = fopen("/etc/vfstab", "r"); |
|
|
|
mtab = fopen("/etc/vfstab", "r"); // Alternate full list file
|
|
|
|
# endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mtab != NULL) |
|
|
|
if (mtab != NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -559,5 +583,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.8 2002/03/29 14:16:03 easysw Exp $".
|
|
|
|
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.9 2002/04/14 12:51:55 easysw Exp $".
|
|
|
|
//
|
|
|
|
//
|
|
|
|