File::Spec::Mac - File::Spec for MacOS |
File::Spec::Mac - File::Spec for MacOS
require File::Spec::Mac; # Done internally by File::Spec if needed
Methods for manipulating file specifications.
The fundamental requirement of this routine is that
File::Spec->catdir(split(":",$path)) eq $path
But because of the nature of Macintosh paths, some additional possibilities are allowed to make using this routine give reasonable results for some common situations. Here are the rules that are used. Each argument has its trailing ``:'' removed. Each argument, except the first, has its leading ``:'' removed. They are then joined together by a ``:''.
So
File::Spec->catdir("a","b") = "a:b:" File::Spec->catdir("a:",":b") = "a:b:" File::Spec->catdir("a:","b") = "a:b:" File::Spec->catdir("a",":b") = "a:b" File::Spec->catdir("a","","b") = "a::b"
etc.
To get a relative path (one beginning with :), begin the first argument with : or put a ``'' as the first argument.
If you don't want to worry about these rules, never allow a ``:'' on the ends of any of the arguments except at the beginning of the first.
Under MacPerl, there is an additional ambiguity. Does the user intend that
File::Spec->catfile("LWP","Protocol","http.pm")
be relative or absolute? There's no way of telling except by checking for the existence of LWP: or :LWP, and even there he may mean a dismounted volume or a relative path in a different directory (like in @INC). So those checks aren't done here. This routine will treat this as absolute.
File::Spec->catfile($ENV{HOME},"file");
and
File::Spec->catfile($ENV{HOME},":file");
give the same answer, as one might expect.
$ENV{TMPDIR}
As a special case, the file name '' is always considered to be absolute.
Unlike File::Spec::Unix-
abs2rel()>, this function will make
checks against the local filesystem if necessary. See
file_name_is_absolute for details.
Unlike File::Spec::Unix-
rel2abs()>, this function will make
checks against the local filesystem if necessary. See
file_name_is_absolute for details.
File::Spec::Mac - File::Spec for MacOS |