diff options
| author | Manolo Gouy <Manolo> | 2016-04-11 13:07:08 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-11 13:07:08 +0000 |
| commit | 5b44fe3bff5a86b888a39b27ceaa8636559e21a9 (patch) | |
| tree | 44cefad634f4b19b710f01e7de10e47790b33a9c /src/drivers/Darwin | |
| parent | aafd8b6031e66e0b2f727197c1d1d040036ec0a8 (diff) | |
Remove compilation errors in Fl_File_Icon.cxx with MSVC compiler with new method Fl_System_Driver::file_type().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11581 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Darwin')
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 31b8e4564..d51fdeedf 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -85,6 +85,7 @@ public: virtual int lock(); virtual void unlock(); virtual void* thread_message(); + virtual int file_type(const char *filename); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index 746fe95ea..3929c63c6 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -35,6 +35,7 @@ #include <sys/param.h> #include <sys/ucred.h> #include <sys/mount.h> +#include <sys/stat.h> #include <ApplicationServices/ApplicationServices.h> @@ -229,6 +230,34 @@ void *Fl_Darwin_System_Driver::dlopen(const char *filename) { return ::dlopen(filename, RTLD_LAZY); } +int Fl_Darwin_System_Driver::file_type(const char *filename) +{ + int filetype; + struct stat fileinfo; // Information on file + if (!stat(filename, &fileinfo)) + { + if (S_ISDIR(fileinfo.st_mode)) + filetype = Fl_File_Icon::DIRECTORY; +# ifdef S_ISFIFO + else if (S_ISFIFO(fileinfo.st_mode)) + filetype = Fl_File_Icon::FIFO; +# endif // S_ISFIFO +# if defined(S_ISCHR) && defined(S_ISBLK) + else if (S_ISCHR(fileinfo.st_mode) || S_ISBLK(fileinfo.st_mode)) + filetype = Fl_File_Icon::DEVICE; +# endif // S_ISCHR && S_ISBLK +# ifdef S_ISLNK + else if (S_ISLNK(fileinfo.st_mode)) + filetype = Fl_File_Icon::LINK; +# endif // S_ISLNK + else + filetype = Fl_File_Icon::PLAIN; + } + else + filetype = Fl_File_Icon::PLAIN; + return filetype; +} + // // End of "$Id$". // |
