|
|
Windows 10 / FLTK 1.4 / Built locally with Microsoft Visual Studio 2019
Here is a sample:
// verify our working directory is "e:/temp"
char buff[100];
char* cwd = fl_getcwd(buff, sizeof(buff));
assert(!strcmp(cwd, "E:\\temp"));
// This fails: the result is "E:/temp/.."
fl_filename_absolute(buff, sizeof(buff), "..");
assert(!strcmp(buff, "E:/");
The problem is that the loop logic in filename_absolute fails to account for a ".." with no following directory separator.
Changing this line:
if (start[1]=='.' && isdirsep(start[2])) {
to this:
if (start[1] == '.' && (isdirsep(start[2]) || !start[2])) {
gives the correct results.
I've tested this on Windows but looking at the code in filename_absolute.cxx, the problem will occur there as well.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
[ Direct Link to Message ] | |
|
| |