Question

I'm having a bit of trouble accessing the default folder for application scripts using this code (which I think is the right way to do it):

NSError* error;
NSURL* scriptsFolderURL = [[NSFileManager defaultManager] URLForDirectory: NSApplicationScriptsDirectory inDomain: NSUserDomainMask appropriateForURL: nil create: YES error: &error];

NSLog(@"%@", scriptsFolderURL);
NSLog(@"%@", [error description]);

The problem is that both NSLog calls print (null), meaning I'm not getting anything. What am I doing wrong?

Was it helpful?

Solution 2

As long as you have a valid Info.plist containing a valid Application Bundle ID and are running under OS X 10.8, this should work fine.

However, I can confirm that it isn't uncommon for the API to return nil with a nil error, which is a bit outside of the API contract.

OTHER TIPS

The comment for NSApplicationScriptsDirectory is as follows:

// location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id)

The code-signing-id gives the hint that you HAVE TO enable code-signing. As soon as you enable code-signing you'll receive a proper URL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top