summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_System_Driver.H3
-rw-r--r--src/Fl_File_Input.cxx11
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.H1
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx7
4 files changed, 14 insertions, 8 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H
index 5073be7ec..db3784d7b 100644
--- a/FL/Fl_System_Driver.H
+++ b/FL/Fl_System_Driver.H
@@ -30,6 +30,7 @@
#include <FL/Fl_Preferences.H>
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
class Fl_File_Icon;
class Fl_File_Browser;
@@ -147,6 +148,8 @@ public:
virtual void *dlopen(const char *filename) {return NULL;}
// the default implementation is most probably enough
virtual void png_extra_rgba_processing(unsigned char *array, int w, int h) {}
+ // the default implementation is most probably enough
+ virtual const char *next_dir_sep(const char *start) { return strchr(start, '/');}
};
#endif // FL_SYSTEM_DRIVER_H
diff --git a/src/Fl_File_Input.cxx b/src/Fl_File_Input.cxx
index 8d1584468..be343d9b6 100644
--- a/src/Fl_File_Input.cxx
+++ b/src/Fl_File_Input.cxx
@@ -18,6 +18,7 @@
//
#include <FL/Fl.H>
+#include <FL/Fl_System_Driver.H>
#include <FL/Fl_File_Input.H>
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
@@ -112,10 +113,7 @@ void Fl_File_Input::update_buttons() {
start && i < (int)(sizeof(buttons_) / sizeof(buttons_[0]) - 1);
start = end, i ++) {
// printf(" start = \"%s\"\n", start);
- if ((end = strchr(start, '/')) == NULL)
-#if defined(WIN32) || defined(__EMX__)
- if ((end = strchr(start, '\\')) == NULL)
-#endif // WIN32 || __EMX__
+ if ((end = Fl::system_driver()->next_dir_sep(start)) == NULL)
break;
end ++;
@@ -261,10 +259,7 @@ Fl_File_Input::handle_button(int event) // I - Event
for (start = newvalue, end = start; start && i >= 0; start = end, i --) {
// printf(" start = \"%s\"\n", start);
- if ((end = strchr(start, '/')) == NULL)
-#if defined(WIN32) || defined(__EMX__)
- if ((end = strchr(start, '\\')) == NULL)
-#endif // WIN32 || __EMX__
+ if ((end = (char*)Fl::system_driver()->next_dir_sep(start)) == NULL)
break;
end ++;
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index 5e580f15c..5ffe037a2 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -84,6 +84,7 @@ public:
const char *application);
virtual void *dlopen(const char *filename);
virtual void png_extra_rgba_processing(unsigned char *array, int w, int h);
+ virtual const char *next_dir_sep(const char *start);
};
#endif // FL_WINAPI_SYSTEM_DRIVER_H
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
index 529f9ade7..5b9676fdf 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
@@ -877,6 +877,13 @@ void Fl_WinAPI_System_Driver::png_extra_rgba_processing(unsigned char *ptr, int
}
}
+const char *Fl_WinAPI_System_Driver::next_dir_sep(const char *start)
+{
+ const char *p = strchr(start, '/');
+ if (!p) p = strchr(start, '\\');
+ return p;
+}
+
//
// End of "$Id$".
//