Re: Changes to "POSIX" in Tiger?
Re: Changes to "POSIX" in Tiger?
- Subject: Re: Changes to "POSIX" in Tiger?
- From: has <email@hidden>
- Date: Tue, 3 May 2005 11:37:31 +0100
Sean Butler wrote:
>In the routine that gets called when the open panel is closed, the path from the user is suppose to be converted from having "/" to having ":" for use with the Finder later.
>
> set thePosixLocation to (POSIX path of (item 1 of (path names of open panel as list)))
>
>In Panther, using the POSIX path specifier would end up removing the UNIX "/" for the Mac ":". Now it does not. However, playing in Script Editor I see some combinations of "POSIX path of" and "POSIX file" do give a ":". Though at this point I'm not 100% sure which is suppose to be right and which ones might be wrong.
>
>Like I said - am I missing a POSIX use here (or did I abuse a past bug in POSIX)?
You're exploiting a bug in AppleScript's POSIX path handling. In any case munging path strings, especially HFS ones, is unreliable and completely unnecessary. Here's the right way to get fileURL objects, alias objects and Finder references from POSIX path strings:
set posixPath to item 1 of (get path names of open panel)
set fileURL to posixPath as POSIX file
set theAlias to fileURL as alias
tell application "Finder" to set finderRef to item theAlias
Note however that the Finder chokes on fileURL objects, so you can't write (e.g.):
tell application "Finder" to set finderRef to [a ref to] item fileURL
which is annoying if you're dealing with paths to files and folders that may not already exist. (Feel free to file a bug on this.)
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden