Re: FSSpec, FileURL
Re: FSSpec, FileURL
- Subject: Re: FSSpec, FileURL
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 29 Dec 2003 08:18:37 -0800
On 12/29/03 1:27 AM, "Walter Ian Kaye" <email@hidden> wrote:
>
> Technical Note TN2022
>
> The Death of typeFSSpec: moving along to typeFileURL
>
>
>
> The FSSpec data type is not suitable for encoding information about
>
> files in Mac OS X. Most importantly, FSSpecs cannot encode long or
>
> Unicode file names such as those used in the Mac OS X file system.
>
> In addition, Directory ID numbers and volume reference numbers are
>
> application specific in Mac OS X.
>
>
>
> For the most part, Alias records encoded in Apple events provide
>
> suitable remedy for the shortcomings of FSSpec records, except for
>
> one case - references to files that have yet to be created. In these
>
> cases, the proposed typeFileURL is the best way to provide a such a
>
> pre-determined file reference.
>
>
So... does AS handle this transparently, or should we coerce paths to
>
<<class furl>> instead of to <<class fss >> (file specification), or
>
should we do like JD and coerce to POSIX?
There are only two situations I know where this comes up, with an optional
third.
1. 'open for access': just use 'file' and it works. AppleScript does
whatever is necessary behind the scenes, as always, to coerce to fileURL.
2. 'save in'; from an application. The dictionaries often say 'alias'
because that's what Apple's Standard Suite says, but that' laughable, since
the file doesn't exist and it will error. Two alternates are both coerced by
AppleScript to fileURL: 'file' works in most cases, unless the application
itself has a 'file' keyword. The straight Unicode text file path (or even
string, if no accents are in the disk name) always works: AppleScript
coerces it to fileURL. It should be the regular colon-delimited Unicode text
path. (In OS 10.1, TextEdit required the POSIX path instead, but that's been
fixed.)
3. The optional 'file' where the file already exists already. This one is
wonky at times: it's better to use 'alias', as the Tech note says. That
always works.
No. 2 - the important one - was discussed by both Chris Espinosa and Chris
Nebel when fileURL came to the fore in the early days of OS X, while OS 10.1
was in beta and being released - I think is was AS 1.6 when this got set. It
works very well, as it did back in fss days.
--
Paul Berkowitz
_______________________________________________
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.