Re: HFS paths (was Tell Blocks Considered Harmful)
Re: HFS paths (was Tell Blocks Considered Harmful)
- Subject: Re: HFS paths (was Tell Blocks Considered Harmful)
- From: Doug McNutt <email@hidden>
- Date: Sat, 20 Dec 2008 09:47:05 -0700
At 03:54 -0800 12/20/08, Chris Page wrote:
On Dec 20, 2008, at 11:12 AM, Axel Luttgens wrote:
set X to "/"
(POSIX file X) as text
--> "BootDisk:"
Why suddenly a trailing semicolon?
Because it is required by the HFS path format for volume names.
Let's see if I can correctly recall all the rules from the dark
corners of my old Mac programmer brain.
HFS Path Format ("..." indicates zero or more characters):
1. "Name" - A simple name with no colons indicates a file or folder
in the current working directory.
2. "Name:..." - One or more colons indicates a path. A name
preceding the first colon is a volume name.
3. "...:Name" - A name following the last colon is a file or folder name.
4. "...:Name:..." - Names between colons are, naturally, folder
names. (3 & 4 effectively make the colon optional after the last
folder name in a path.)
5. ":..." - A colon with no preceding name indicates the current
working directory. This is like "./" at the start of a POSIX path.
6. "...::..." - Two consecutive colons indicates the container at
that point in the path. This is like "../" in a POSIX path.
Add to that a caveat that a name/path with no colons at all cannot be
a directory. Otherwise it would be impossible to name a file BootDisk
in the current working directory.
That's the real answer to the original question.
MPW handles it by putting the colon after the names of all
directories. That bothered UNIX folks using MPW because you no longer
added a solidus or colon between two concatenated environment
variables, the first of which was a directory. $HOME/$adefinedname
becomes {HOME}{adefinedname} and you have to use the braces because
the HOME variable contains the trailing colon. A leading colon
guarantees that a path starts in the current working directory which
is just the opposite of a leading solidus that indicates the root in
UNIX.
The double and triple colons, I believe, are supported only in MPW.
The classic OS never provided that capability for a user or for
AppleScript. AUX did exist though.
Find TRUTH at "Introduction to MPW" p 4-31 Apple Developer Press 1994-5
--
--> A fair tax is one that you pay but I don't <--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden