• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: HFS paths (was Tell Blocks Considered Harmful)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HFS paths (was Tell Blocks Considered Harmful)


  • Subject: Re: HFS paths (was Tell Blocks Considered Harmful)
  • From: KOENIG Yvan <email@hidden>
  • Date: Sun, 21 Dec 2008 16:49:35 +0100


Le 21 déc. 2008 à 14:25, Axel Luttgens a écrit :

Le 21 déc. 08 à 13:15, KOENIG Yvan a écrit :

[...]

I'm not a pro

Nor am I... ;-)


so I may be wrong but I don't understand why the first slash would can't have the behaviour of the late one when it is the unique slash available.

Remember the Holy Books: "Les premiers seront les derniers".

When it is the unique slash, the one IS the current root directory AND a path separator.

Yes, I hesitated on how to expose those matters, as there are at least two ways to do so.


The most common way (the one I followed in my post) is to say that the initial slash in
/path/to/some/item
just represents the root directory, the very special case being the path reduced to
/
With such an interpretation, the initial slash *is* the root directory and may not be confused with any other slash appearing in a path string; moreover, the initial path then doesn't play the role of a path separator at all.


But it could also be argued that the root directory, being unique, has a very special name: the empty string (this of course makes sense only if no other item in the filesystem may receive such a name). Moreover, the root directory being not contained into another directory, an absolute path must thus be interpreted as:
<name of root directory>/path/to/some/item
<empty string>/path/to/some/item
even if just written as:
/path/to/some/item
With such an interpretation, the initial slash (which, strictly speaking, isn't the first piece of the path anymore), indeed plays the role of a path separator.

Here I don't understand.
Whe we concatenate an empty string with the string "/path/to/some/ thing", the initial slash IS the first character of the resulting string.


But it is a very special slash anyway, as it is the one allowing to indicate that one is starting at the root directory. And designating the root directory by this path:
/
now appears as a mandatory notational artifact, because the root directory can't be unambiguously specified by its name (the empty string) alone; the latter path indeed shows a slash, but again that slash is a very special one.


As a general rule, whichever interpretation is the preferred one, it appears that an initial slash (if any) in a path string has a very special status.

Axel

I continue to disagree. When the slash is unique it's the first AND the last. As the first it means: volume directory As the last it means: path separator. It's exactly the same object than //. In this case, the first slash is ONLY volume directory and the second one is ONLY path separator. Both of them return "Macintosh HD:"

So, from my point of view, it's logical that / returns: "Macintosh HD:"
as well as
/Users/  returns "Macintosh HD:Users:"

What is surprising from my point of view is the behaviour of:

(POSIX file "Macintosh HD/" as file as text)
which returns: ":Macintosh HD:"

Other detail, if I code

set p to (POSIX file "/Volumes/Foo" as file as text)

If Foo is a folder, it fails at execution (a folder is not a file)
If Foo is not a folder, there is no reason to have a path separator after it.


Yvan KOENIG (from FRANCE dimanche 21 décembre 2008 16:49:31)




_______________________________________________ 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
References: 
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: Richard Rönnbäck <email@hidden>)
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: Axel Luttgens <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: Chris Page <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: Axel Luttgens <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: KOENIG Yvan <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: Axel Luttgens <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: KOENIG Yvan <email@hidden>)
 >Re: HFS paths (was Tell Blocks Considered Harmful) (From: Axel Luttgens <email@hidden>)

  • Prev by Date: OSA modernization and scope
  • Next by Date: Re: HFS paths (was Tell Blocks Considered Harmful)
  • Previous by thread: Re: HFS paths (was Tell Blocks Considered Harmful)
  • Next by thread: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Index(es):
    • Date
    • Thread