summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.H1
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx10
-rw-r--r--src/filename_ext.cxx21
3 files changed, 18 insertions, 14 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index 8203317ac..3e5f06d39 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -74,6 +74,7 @@ public:
virtual int filename_absolute(char *to, int tolen, const char *from);
virtual int filename_isdir(const char* n);
virtual int filename_isdir_quick(const char* n);
+ virtual const char *filename_ext(const char *buf);
};
#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 693fd296d..246a26521 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
@@ -648,6 +648,16 @@ int Fl_WinAPI_System_Driver::filename_isdir_quick(const char* n)
return filename_isdir(n);
}
+const char *Fl_WinAPI_System_Driver::filename_ext(const char *buf) {
+ const char *q = 0;
+ const char *p = buf;
+ for (p = buf; *p; p++) {
+ if (isdirsep(*p) ) q = 0;
+ else if (*p == '.') q = p;
+ }
+ return q ? q : p;
+}
+
//
// End of "$Id$".
//
diff --git a/src/filename_ext.cxx b/src/filename_ext.cxx
index 367d57145..f07e6797f 100644
--- a/src/filename_ext.cxx
+++ b/src/filename_ext.cxx
@@ -16,18 +16,10 @@
// http://www.fltk.org/str.php
//
-// returns pointer to the last '.' or to the null if none:
+#include <FL/Fl_System_Driver.H>
+#include <FL/Fl.H>
-#include <FL/filename.H>
-
-#ifdef WIN32
-#elif defined(__APPLE__) // PORTME: Fl_System_Driver - filename stuff
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: implement directory and filename handling for your platform if needed"
-#else // X11
-#endif
-
-/** Gets the extensions of a filename.
+/** Gets the extension of a filename.
\code
#include <FL/filename.H>
[..]
@@ -39,13 +31,14 @@
\return a pointer to the extension (including '.') if any or NULL otherwise
*/
const char *fl_filename_ext(const char *buf) {
+ return Fl::system_driver()->filename_ext(buf);
+}
+
+const char *Fl_System_Driver::filename_ext(const char *buf) {
const char *q = 0;
const char *p = buf;
for (p=buf; *p; p++) {
if (*p == '/') q = 0;
-#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
- else if (*p == '\\') q = 0;
-#endif
else if (*p == '.') q = p;
}
return q ? q : p;