Created
August 23, 2016 04:51
-
-
Save Teraflopst/8b8c1b5605ccd8d3d4790015289d1bd7 to your computer and use it in GitHub Desktop.
AppleScript and POSIX paths translation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Description: | |
-- POSIX path uses the slash "/" as the separator. POSIX path looks like Unix style path | |
-- AppleScript path uses the colon ":" as the separator | |
-- Read More: http://www.satimage.fr/software/en/smile/external_codes/file_paths.html | |
-- To translate a UNIX path (file or directory, valid or not) into an AppleScript file reference. | |
set p to "/usr/local/bin/" | |
set a to POSIX file p | |
-- file "Macintosh HD:usr:local:bin:" | |
-- To translate an AppleScript path (file or directory, valid or not) into a POSIX path. | |
set a to "Macintosh HD:usr:local:bin:" | |
set p to POSIX path of a | |
-- "/usr/local/bin/" | |
-- POSIX path also understands AppleScript's file references. | |
set a to alias "Macintosh HD:usr:local:bin:" | |
set p to POSIX path of a | |
-- "/usr/local/bin/" | |
set a to file "Macintosh HD:usr:local:bin:" | |
set p to POSIX path of a | |
-- "/usr/local/bin/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment