Re: Elementary fie naming question
Re: Elementary fie naming question
- Subject: Re: Elementary fie naming question
- From: Graff <email@hidden>
- Date: Sun, 11 Jan 2004 14:17:54 -0500
On Jan 11, 2004, at 1:06 PM, Axel Luttgens wrote:
Those characters are mainly forward slashes (/) and colons (:). The
forward slash is a path delimiter for the shell environment and the
colon is a path delimiter for the Finder.
It used to be that if you specified a date as part of a name in the
Finder and it had a format of xx/xx/xx it would automatically change
to xx-xx-xx.
Damn! I never noticed this...
But you may never be sure, and as you insisted upon this, I immediately
woke my good old PB 170 with MacOS 7.5.5 and gave this a trial.
No problem: I renamed a folder as "Dossier 03/03/99" and it happily
kept
that name unchanged.
Should I go back to Finder 4.1?
By "used to be" I meant in early Mac OS X the Finder did this.
Obviously pre-Mac OS X there was little reason for the Finder to worry
about forward slashes.
It now looks like the Finder leaves that untouched, which is
potentially a bad thing. If a shell tool is used on a name that has
forward slashes in it then that name could get misinterpreted. For
example a file with the name aaa/bbb in the Desktop folder would be
referenced like this in the shell:
/Users/username/Desktop/aaa/bbb
No; as I wrote, it would be:
/Users/username/Desktop/aaa:bbb
because of a nice trickery used by the Finder in order to avoid
problems
with the underlying unix file system, while allowing compatibility with
the full line of MacOS behaviors (conversely, a file/folder created in
unix with a ":" in its name would display a "/" in the Finder).
From the Finder's point of view, there is a slash in the name.
From a unix point of view, there is a semicolon in the name.
So, when I create a file named "aaa/bbb" in the finder and stay in the
finder, I'll use that name to refer to that file.
Now, if for some reason I need to work on that file from within unix, I
know I will have to use "aaa:bbb" as the file's name.
What's the problem?
The problem is one of potential confusion. If someone was to get a
file path one way and then use it another then the odd characters could
cause a naming clash. Yes, it is not extremely likely but it is a
POTENTIAL problem as I have noted. It is safer to simply avoid those
two characters if at all possible.
The same thing happens for files with a colon in them in the Finder,
although it is rarer to have a problem there due to the fact that the
Finder doesn't depend on paths as much.
No? In what sense?
The likelihood is that a program that uses the Carbon or Cocoa
libraries will use file system references, which do not have the
limitations that file names do. Each file system reference is
guaranteed to be unique. The Finder uses file system references
"behind the scenes" and thus it is less likely to have a problem
confusing files than a shell program that references on a text string.
Another example of confusion, I named a folder "Date 10/20/02" on the
Desktop in the Finder. When I did a listing of the Desktop through
the shell environment that same folder was named "Date 10:20:02".
Didn't I precisely write that in my previous post?
You did write that a forward slash would get converted to a colon, yes.
However, one of the confusions I was referring to was that a file
named after a calendar date of 10/20/02 now looks as though it is a
time of 10:20:02. This can add to the confusion problems.
I know that there are protections built-in to the file naming routines
which are attempts to avoid these kinds of problems and for the most
part they work well. However, they are not a catch-all for every
single instance of confusion. I would prefer to avoid as many
potential problems as possible and be a bit more conservative in my
file naming.
- Ken
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.