diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-07-30 18:33:49 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-07-30 18:33:49 +0000 |
| commit | 9456baab50e8937d9a843a362847d589958694f9 (patch) | |
| tree | 6d79a87d703b84840f57a5b9c5c67729012b7ba7 /src | |
| parent | 1cea00ad00e75262cedd3a96f2e7ac39a7b640c8 (diff) | |
Fix some problems with the filename field and handling selections in the
root directory (Fl_File_Chooser).
Add documentation for the fl_cursor() function.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2558 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 6109544b5..20fcd5b05 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.20 2002/07/14 18:26:54 easysw Exp $" +// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.21 2002/07/30 18:33:49 easysw Exp $" // // More Fl_File_Chooser routines. // @@ -382,10 +382,12 @@ Fl_File_Chooser::fileListCB() if (!filename) return; - if (directory_[0] != '\0') { - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); - } else { + if (!directory_[0]) { strlcpy(pathname, filename, sizeof(pathname)); + } else if (strcmp(directory_, "/") == 0) { + snprintf(pathname, sizeof(pathname), "/%s", filename); + } else { + snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); } if (Fl::event_clicks()) { @@ -449,8 +451,7 @@ Fl_File_Chooser::fileNameCB() // Get the filename from the text field... filename = (char *)fileName->value(); - if (filename == NULL || filename[0] == '\0') - { + if (filename == NULL || filename[0] == '\0') { okButton->deactivate(); return; } @@ -538,8 +539,12 @@ Fl_File_Chooser::fileNameCB() directory(pathname); - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); - fileName->value(pathname); + if (filename[0]) { + char tempname[1024]; + + snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename); + fileName->value(tempname); + } fileName->position(p, m); } @@ -1138,5 +1143,5 @@ unquote_pathname(char *dst, // O - Destination string // -// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.20 2002/07/14 18:26:54 easysw Exp $". +// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.21 2002/07/30 18:33:49 easysw Exp $". // |
