[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Porting File::PathConvert



At 10.28 -0500 1999.02.03, Barrie Slaymaker wrote:
>> Also, the details of paths on Mac OS are specified in the Mac section of
>> perlport.pod, in a perl5.005 or CPAN site near you.  :)
>
>Already been there... it's too vague. For instance, is
>volume1:folder1:::volume2:folder2:file legal? I assume
>so, but it doesn't say.

No.  You'd have to have a root directory to do that.  There is nothing
"before" volume1: to go back to.


>FWIW, I'm aiming at returning a minimal path too, so
>":a:b" + "::c" yields ":a:c", not ":a:b::c". It's not that
>important, but it makes for cleaner output.

You can't do that, though.  See below.


>I'm also not sure why File::Spec::Mac::file_name_is_absolute()
>depends on having :file exist. My guess is that it is to
>differentiate "file" from "volume".

Note that the -e test is only performed if there is no : in the name.  And
actually, this is not a great way to test, but it is the best that could be
done.  If you have a file in the current directory named "HD" and your
volume is named "HD", you are in trouble.  The best thing to remember is
that volume names and folder names SHOULD always be trailed by a :.  If you
do that, you're safe.


>Also, which volume and folder are checked for -e ":file"?

The current directory.


>This makes it difficult to work with paths that aren't
>present on the local machine.

In case there is still confusion, no, because the -e test is only performed
for strings without a : in them.


>What is the exact meaning of the file spec "file"?

I don't follow.


>> >And any suggestions for converting paths to a minimal canonical
>> >form. For instance, under Unix-lie filesystems, '/name/..'
>> >and '/////' are both removed.
>>
>> No such thing in Mac OS.  :: means to go back one directory.
>> ::: means go back two directories.
>
>I understand about ':::'.  Can ':name::' be transformed to ':'
>in all cases?

No.  name: could be a symbolic link (alias).  To use your example above, I
have this file spec:

    Bird:MacPerl:site_perl:::java:

If you simplified it by hand, it would be:

    Bird:java:

But it actually resolves to:

    Bird:src:Pudge:pudgeprogs:java:

Because site_perl is an alias to:

    Bird:src:Pudge:pudgeprogs:perl:site_specific:



It's the same thing in Unix, too.

    /export/home/chrisn/doc/../cgi-bin

This does not resolve to:

    /export/home/chrisn/cgi-bin

But rather:

    /mounts/web/ns-home/cgi-bin

Because ~/doc is a symbolic link to:

    /mounts/web/ns-home/doc/

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch