Re: tutorial on HFS versus finder and POSIX file path ?
Re: tutorial on HFS versus finder and POSIX file path ?
- Subject: Re: tutorial on HFS versus finder and POSIX file path ?
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 17 Oct 2006 11:45:34 -0400
On 10/17/06, Yvon Thoraval <email@hidden> wrote:
Hey all,
i'm new to as and more or less lost with the different way to
represent a file path :
the finder one, the HFS one and POSIX one.
What is the difference between what you're calling "Finder" and "HFS"?
As far as I know, there are only two styles of pathname. Unless by
"Finder" you're referring to the AppleScript syntax (file of folder of
disk, etc.). This AS snippet:
tell application "Finder"
display dialog (folder "mreed" of folder "Users" of disk
"Greyskull") as string
end tell
will give you the traditional Mac OS pathname notation:
Greyskull:Users:mreed
(where "Greyskull" is the name of my boot disk, formerly "Macintosh HD")
The POSIX-style equivalent is just /Users/mreed, because Greyskull is
the root volume:
display dialog (POSIX file "/Users/mreed")
in fact, if I type the above into Script Editor, it magically
redecompiles to this:
display dialog (file "Greyskull:Users:mreed")
The translation rules are simple:
Mac OS: absolute paths start with the volume name; the separator is a
colon. A pathname starting with a colon is relative, but it's hard to
say to what, since there's no well-defined concept of a "working
folder" in traditional Mac OS.
POSIX: absolute paths start with a /, which is also the separator.
The boot volume is /, any other mounted volumes are /Volumes/volname/.
Relative paths start with a name with no leading /.
A file that shows up in the Finder as "foo/bar" will show up in the
shell as "foo:bar".
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden