Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path seperator character



Scott Kovatch <email@hidden> wrote:

>File.separator is the character that delimits directories in a
>filename. On Mac OS X that's a '/'. (On Mac OS 9 that character was
>a ':', as you mentioned.) The path separator (File.pathSeparator) is
>used as the delimiter for a list of paths, or a list of JAR files.

The ':' is path-separator, but it can appear in filenames. Every name that
the Mac OS X Finder shows containing an embedded '/' appears to Java
programs with an embedded ':' instead. That is, if you see this on a file
or folder in the Finder:
My-I/O

it will show up like this to a Java program or shell command:
My-I:O

On classic Mac OS, this would have been escaped in a URLish way, like so:
My-I%2FO


For real fun, try this... The special names "." and ".." have specific
meanings on Mac OS X. But not on any classic Mac OS, where they are Just
Another Folder Name. So:
1) Boot in Mac OS 9.
2) Create a folder somewhere and name it "..".
3) Put a file containing important data into "..".
4) Reboot in Mac OS X.
5) Go where you put the ".." folder.
6) Observe that you can't see or access the ".." folder.
7) Start Terminal and go where you put "..".
8) Type "ls -la" and observe TWO ".." dirs listed.
9) You still can't get to the ".." you created.
10) You can't get to it by any Java program, either.

For what it's worth, MRJ 2.* on classic Mac OS has a similar problem with
the "." and ".." semantics. That is, an actual file or folder having that
name is utterly inaccessible to a Java program, even when it's in a
File.list().

Moral of the story: don't name anything "." or ".." in classic Mac OS.
Especially not on removable media, and especially not burned to CD-Rs.

-- GG

p.s. I'm not even gonna bother filing a bug-report on this. There's
essentially nothing that can be done, except perhaps forbidding "." and
".." in Mac OS 9, and adding that seems unlikely.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.