Sunday, November 19, 2017

#1 2005-10-12 07:31:50 am

julifos
Administrator
From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

In OS X, how do I convert colon-delineated-paths to *nix-style paths?

In order to maintain compatibility with earlier OS releases, file paths are expressed in AppleScript as colon-delineated. In more early versions of OS X, a conversion had to be done using a handler. Now the POSIX path command handles it simply. For example:

Applescript:

set filePath to alias "Mac OS X:Users:username:Desktop:Jazz Files:play target track"

POSIX path of filePath --> "/Users/username/Desktop/Jazz Files/play target track"

Or:

Applescript:

quoted form of POSIX path of filePath --> "'/Users/username/Desktop/Jazz Files/play target track'"

Which is very useful if you want pass the path to the shell and the file contains spaces or special characters in its path (which will make it unusable).

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)