Unable to refer to iCloud Drive in launchd plist

0

1

I have started keeping my AppleScripts in Script Editor's iCloud Drive folder, as oftentimes, I like to reuse or review scripts on multiple devices. Generally I love iCloud Drive. However, I have come across an unusual scenario: I am unable to successfully use such a path in the ProgramArguments section of my launchd plist.

Ordinarily, the path takes the form ~/Library/Mobile\ Documents/com\~apple\~ScriptEditor2/Documents/MyScript.scpt

But I can see from the logs that this path gets well and fully mangled when launchd tries to execute it, and of course the result is "No such file or directory." What I'm seeing is, the second and third tildes are dynamically replaced with the path to the user's home folder -- something only the first tilde technically refers to. I've tried various ways to escape it, but to no avail.

Any thoughts on getting around this issue?

ayampols

Posted 2015-03-12T22:49:48.060

Reputation: 1

Answers

1

You can leave the globbing to a real shell:

<key>ProgramArguments</key>
<array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>programToRun --arg1 --arg2 ~/relative\~path\~here</string>
</array>

LCC

Posted 2015-03-12T22:49:48.060

Reputation: 166