in reply to Working directory oddity
Win32's GetFullPathName and GetLongPathName will do that.
The former also converts the path to an absolute path.
The latter also expands short file names into long file names.
use Win32 qw( ); # Win32 doesn't export these, so we'll import them manually. BEGIN { no strict 'refs'; *$_ = \&{"Win32::$_"} for qw( GetLongPathName GetFullPathName ); } my $path = "\\DOCUMENTS AND SETTINGS"; # If you wish to keep relative paths relative: print GetLongPathName($path); # If you wish to make relative paths absolute: print GetLongPathName(scalar(GetFullPathName($path)));
Note that Win32's GetCwd returns the path as provided to chdir.
Tested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Working directory oddity
by sg (Pilgrim) on Oct 19, 2007 at 06:02 UTC | |
by ikegami (Patriarch) on Oct 19, 2007 at 06:10 UTC | |
by sg (Pilgrim) on Oct 19, 2007 at 15:07 UTC | |
by ikegami (Patriarch) on Oct 19, 2007 at 15:12 UTC | |
by sg (Pilgrim) on Oct 19, 2007 at 15:28 UTC |