On Aug 12, 2010, at 5:16 PM, Emmanuel LEVY wrote:
set f to "/Users/emmanuel/Desktop/fred/" set actualfolder to posix path of (f as alias) -- may be /Volumes/Library-1/etc set somepath to actualfolder & "some/path/to/some/item" read posix file somepath
I'm having a problem with (f as alias) where f is clearly a posix path. (Emmanuel, did you get any error with (f as alias)?) I have never had any trouble converting an alias to a posix path for use in a 'do shell script ...'. This afternoon, I have been trying to convert a valid posix path to an alias. This seems to be impossible.
A search turned up this recent remark: On 10/07/2010, at 9:55 PM, Shane Stanley wrote:
For some reason can't use "POSIX file" in a specifier -- you have to coerce:
set hfsPath to (((POSIXPath as text) as POSIX file) as text)
After experimenting with this for awhile, I found that 'hfsPath' isn't really an hfs path. I've broken the example into steps, as follows:
alias "OS_X:Users:lutherfuller:Desktop:symlink Testing:TEST-FOLDER" set posixPath to (quoted form of (POSIX path of the result)) posixPath as text --> '/Users/lutherfuller/Desktop/symlink Testing/TEST-FOLDER/' the result as POSIX file --> file ":':Users:lutherfuller:Desktop:symlink Testing:TEST-FOLDER:'" the result as text --> :':Users:lutherfuller:Desktop:symlink Testing:TEST-FOLDER:' the result as alias --> Error: file :':Users:lutherfuller:Desktop:symlink Testing:TEST-FOLDER:' wasn't found. log the result
Surely, there is a simple way to convert a valid posix path to an alias, but I haven't found it yet. In other words, (f as alias) always errors ... at least for me!
|