Sv: Sv: Sv: Sv: Sv: Sv: g++ and c++17 filesystem

sten.kristian.ivarsson@gmail.com sten.kristian.ivarsson@gmail.com
Wed Nov 25 08:02:10 GMT 2020


> For the specific case C:\Temp, I found this:
> 
> cygpath -ua 'C:\Temp'
> 
>    -> /cygdrive/c/Temp
> 
> cygpath -ua /cygdrive/c/Temp
> 
>    -> /cygdrive/c/Temp
> 
> cygpath -ua '\Temp'
> 
>    -> /cygdrive/c/Temp
> 
> cygpath -ua '/Temp'
> 
>    -> /Temp
> 
> Now Cygwin is open source, so you, too, could grab the code in cygpath and
> call it as a subroutine, maybe, to try to canonicalize a wider range of
> paths.

Yeah, thanx for the tip, but this functionality won't be available on other
*nix-platforms, so some kind of #ifdef is required

> Note the interesting difference between the \Temp and /Temp cases.
> cygpath is processing \Temp as a Windows-like thing, and thus interpreting
> it according the the Windows root for the current drive.  However, it
> processes /Temp and a Posix-like path, which will be in term of the
> _Cygwin_ root, generally the CYgwin install directory.
> 
> Still, if you did this canonicalization first, maybe you would get more
> what you're looking for?  I'm not sure it would be a good idea to insert
> this generally into the Cygwin library stack.  Others more familiar with
> the fine details can probably elaborate why.

I experimented by fiddling around with making the path canonical and as you
say, maybe we will be more successful and that could still be a part of our
code that is not platform dependant

I guess we need to go out of std::filesystem::canonical though because that
is what fails (and unfortunately I guess there's a real bug in the (real)
g++ distro of <filesystem> because the
std::filesystem::path::generic-functions doesn't work as the standard
mandates either)


Once again, thanx for the tips


Best regards,
Kristian


> Regards - Eliot Moss
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list