Win32::AbsPath - convert relative to absolute paths
use Win32::AbsPath; $path = Win32::AbsPath::Fix '../some\dir\file.doc' system("winword $path"); use Win32::AbsPath qw(Relative2Absolute); @paths = qw( ..\dir\file.txt ./other.doc c:\boot.ini ); Relative2Absolute @paths;
Convert relative paths to absolute. Understands UNC paths.
The functions understands many different types of paths
dir\file.txt ..\dir\file.txt c:\dir\file.txt c:\dir\..\file.txt \dir\file.txt \\server\share\dir\..\file.txt c:dir\file.txt
and of course you may pepper these with whatever mixtures of \.\ and \..\ you like. You may use both forward and backward slashes, the result will be in backward slashes.
! The ussage of paths of type c:file.txt is slightly deprecated. It IS supported, but may lead to a change of current directory. The function first chdir()s top the current directory on the drive mentioned in the path and then back to cwd() in time it was called. If any of those chdir()s fails, the result of the function will be undef.
This is likely to happen if one of the drives is a floppy or CD, or if one of the drives was a network drive and was disconnected.
Converts all paths in @list to absolute paths
in-place. That is the function changes the list you pass in.
$abspath = RelativeToAbsolute $relpath;
Converts the relative path to absolute. Returns the absolute path, but doesn't change the parameter. It takes exactly one parameter!
print join(' ',RelativeToAbsolute '_file.txt','_other.txt'); prints c:\_file.txt _other.txt instead of c:\_file.txt c:\_other.txt
The same as RelativeToAbsolute.
<Jenda@Krynicky.cz> and Mike <email@example.com>