Path string interpretation with 'as alias'
Path string interpretation with 'as alias'
- Subject: Path string interpretation with 'as alias'
- From: Nigel Garvey <email@hidden>
- Date: Wed, 18 Jun 2003 15:49:53 +0100
I've been working on a script that has to check the existence of several
folders, so for speed I've been using the 'coerce path to alias in a try
block' trick:
try
pathString as alias
on error
-- The folder doesn't exist
end try
I want it to run on any system and to differentiate between files and
folders, but it seems that the behaviour of 'as alias' has changed
between 9.2.2 and 10.2.6 with regard to how rigidly trailing colons are
observed:
OS 8.6/9.2.2
"fish:and:chips" as alias
--> Errors if "chips" is a folder
"fish:and:chips:" as alias
--> Errors if "chips" is a file
OS 10.2.6
--> Both forms return aliases to whatever "chips" happens to be
Is this a bug or a feature?
What does work for my purposes on all three systems is 'file pathString
as file specification', which at least takes things seriously when
pathString ends with a colon:
file "fish:and:chips" as file specification
--> Returns a file specification for whatever "chips" happens to be
file "fish:and:chips:" as file specification
--> Errors if "chips" is a file
Curiously, with any of the above in 8.6, if the disk "fish" doesn't
exist, the same path on the current disk is tried instead.
NG
_______________________________________________
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.