FLTK logo

Re: [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 ]

Re: [fltk/fltk] fl_filename_absolute mishandles double-backslash on Windows (#141) erco77 Sep 18, 2020  
 

Of interest, the realpath(1) function would do what this issue wants.
If you do something like (bash script here):

cwd=`pwd`/"../your/relative/path"
abspath=`realpath -m $cwd`

..the result is the proper "cleaned up" absolute path, with unncessary "." and ".."s removed.

In unix we have realpath(3), and under the Windows API there's the GetFullPathNameA() function.
So between those and some of the code I proposed in STR 3441, there might be a way to clean all this up.
Might be a lotta work, or might be a little. Either way a lot of testing is needed, cause there's a lot of side cases; in unix symlinks and multiple slashes, in windows uncs, drive maps, fronts vs backs, symlinks (MKLINK /?), junctions, and lord knows what else.

Beware of dragons in the OS functions; in the case of linux, realpath(3) doesn't work with fictional pathnames, but realpath(1) can with the -m flag, so there's some smarts in there to avoid realpath(3), doing some pathname parsing itself.


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'.