Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken

by Corion (Pope)
on Aug 19, 2013 at 10:58 UTC ( #1050012=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^2: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-10-26 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (152 votes), past polls