http://qs1969.pair.com?node_id=1050012


in reply to Re: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken
in thread Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken

I would say that there is a misconception. C: does not reference the root directory of a volume. It references the current working directory of that volume.

You should either prohibit this or handle it properly, not silently convert to something else, especially not a root directory. I think the failure mode of converting C: to C:/ is a very bad one:

my $p= path("C:"); unlink $_ for $p->children;

For UNC paths, I see no such bad failure mode of appending a trailing directory separator.

Replies are listed 'Best First'.
Re^3: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken
by xdg (Monsignor) on Aug 19, 2013 at 12:55 UTC
    C: does not reference the root directory of a volume

    I understand that. What I'm trying to get guidance on is how likely it is that people would use "C:" and not mean the root directory.

    If I understand you correctly, what probably needs to happen is to immediately turn C: into the absolute path for cwd on that volume via getdcwd.

    Is that right?

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Yes. I would consider it highly likely that people use the system as documented.

      Yes, getcwd getdcwd is the function that needs to get involved to make C: resolve correctly.

        Thank you. A fixed Path::Tiny has been released to CPAN as version 0.029.

        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.