summaryrefslogtreecommitdiff
path: root/src/fl_file_dir.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-11-26 00:15:06 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-11-26 00:15:06 +0000
commiteba128dcc01aae25f688a05683436ab4d508aef6 (patch)
tree7215180cb738dee1dd1c4bc33f8156b0f332f9ad /src/fl_file_dir.cxx
parent2b826b0f318e8df5176d3a5fa2edba4b1811e78d (diff)
New filename_relative() function, and use it from fl_file_chooser() and
fl_dir_chooser(), so that apps like FLUID won't get absolute paths all the time... Update filename_xyz() functions to take a destination size, and provide inline methods for the old FL_PATH_MAX convention. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1731 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_file_dir.cxx')
-rw-r--r--src/fl_file_dir.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx
index 0b622c6f5..f8ffe82d6 100644
--- a/src/fl_file_dir.cxx
+++ b/src/fl_file_dir.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_dir.cxx,v 1.1.2.2 2001/09/30 17:37:06 easysw Exp $"
+// "$Id: fl_file_dir.cxx,v 1.1.2.3 2001/11/26 00:15:06 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -24,6 +24,7 @@
//
#include <config.h>
+#include <FL/filename.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_File_Chooser.H>
@@ -44,6 +45,8 @@ void fl_file_chooser_callback(void (*cb)(const char*)) {
char* fl_file_chooser(const char* message, const char* pat, const char* fname)
{
+ static char retname[1024];
+
if (!fname || !*fname) fname = ".";
if (!fc) {
@@ -61,12 +64,18 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
while (fc->visible())
Fl::wait();
- return ((char *)fc->value());
+ if (fc->value()) {
+ filename_relative(retname, sizeof(retname), fc->value());
+
+ return retname;
+ } else return 0;
}
char* fl_dir_chooser(const char* message, const char* fname)
{
+ static char retname[1024];
+
if (!fname || !*fname) fname = ".";
if (!fc) {
@@ -85,10 +94,14 @@ char* fl_dir_chooser(const char* message, const char* fname)
while (fc->visible())
Fl::wait();
- return ((char *)fc->value());
+ if (fc->value()) {
+ filename_relative(retname, sizeof(retname), fc->value());
+
+ return retname;
+ } else return 0;
}
//
-// End of "$Id: fl_file_dir.cxx,v 1.1.2.2 2001/09/30 17:37:06 easysw Exp $".
+// End of "$Id: fl_file_dir.cxx,v 1.1.2.3 2001/11/26 00:15:06 easysw Exp $".
//