mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 15:46:52 +08:00
Fl_File_Chooser now returns directory names with a trailing slash
to avoid problems with relative filenames (STR #819) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4335 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -2,6 +2,9 @@ CHANGES IN FLTK 1.1.7
|
|||||||
|
|
||||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||||
#744, STR #745)
|
#744, STR #745)
|
||||||
|
- Fl_File_Chooser now returns directory names with a
|
||||||
|
trailing slash to avoid problems with relative
|
||||||
|
filenames (STR #819)
|
||||||
- Fl_Help_View now supports the FONT and U elements (STR
|
- Fl_Help_View now supports the FONT and U elements (STR
|
||||||
#815)
|
#815)
|
||||||
- OpenGL windows that were completely off-screen caused
|
- OpenGL windows that were completely off-screen caused
|
||||||
|
|||||||
@@ -1039,15 +1039,7 @@ Fl_File_Chooser::value(int f) // I - File number
|
|||||||
if (!(type_ & MULTI)) {
|
if (!(type_ & MULTI)) {
|
||||||
// Return the filename in the filename field...
|
// Return the filename in the filename field...
|
||||||
if (!name || !name[0]) return NULL;
|
if (!name || !name[0]) return NULL;
|
||||||
else if (fl_filename_isdir(name)) {
|
else return name;
|
||||||
if (type_ & DIRECTORY) {
|
|
||||||
// Strip trailing slash, if any...
|
|
||||||
strlcpy(pathname, name, sizeof(pathname));
|
|
||||||
slash = pathname + strlen(pathname) - 1;
|
|
||||||
if (*slash == '/') *slash = '\0';
|
|
||||||
return pathname;
|
|
||||||
} else return NULL;
|
|
||||||
} else return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a filename from the list...
|
// Return a filename from the list...
|
||||||
@@ -1065,24 +1057,13 @@ Fl_File_Chooser::value(int f) // I - File number
|
|||||||
strlcpy(pathname, name, sizeof(pathname));
|
strlcpy(pathname, name, sizeof(pathname));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip trailing slash, if any...
|
|
||||||
slash = pathname + strlen(pathname) - 1;
|
|
||||||
if (*slash == '/') *slash = '\0';
|
|
||||||
return pathname;
|
return pathname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If nothing is selected, use the filename field...
|
// If nothing is selected, use the filename field...
|
||||||
if (!name || !name[0]) return NULL;
|
if (!name || !name[0]) return NULL;
|
||||||
else if (fl_filename_isdir(name)) {
|
else return name;
|
||||||
if (type_ & DIRECTORY) {
|
|
||||||
// Strip trailing slash, if any...
|
|
||||||
strlcpy(pathname, name, sizeof(pathname));
|
|
||||||
slash = pathname + strlen(pathname) - 1;
|
|
||||||
if (*slash == '/') *slash = '\0';
|
|
||||||
return pathname;
|
|
||||||
} else return NULL;
|
|
||||||
} else return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user