FLTK logo

[fltk/fltk] fl_filename_absolute mishandles double-backslash on Windows (#141)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] fl_filename_absolute mishandles double-backslash on Windows (#141) Kevin Routley Sep 17, 2020  
 

Windows 10 / FLTK 1.4 / Built locally with Microsoft Visual Studio 2019

I've been having problems with fl_filename_absolute on Windows. 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 one works
    fl_filename_absolute(buff, sizeof(buff), "./log.txt");
    assert(!strcmp(buff, "E:/temp/log.txt"));

    // this one fails [result is "E:/temp/..\\log.txt"
    fl_filename_absolute(buff, sizeof(buff), ".\\log.txt");
    assert(!strcmp(buff, "E:/temp/log.txt"));    

Stepping into the fl_filename_absolute() call, I find that any invocation of isdirsep inside Fl_WinAPI_System_Driver.cxx is using the version of isdirsep in filename_absolute.cxx. The latter does not accept the double-backslash.

My fix was to declare each instance of isdirsep to be static. Then Fl_WinAPI_System_Driver::filename_absolute would use the correct version of isdirsep.

As of this writing, I have not yet tested the change on Linux.


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 ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.