On 9 Jun 2017, at 10:13 pm, Dragan Milić <[email protected]> wrote: > > NSError *error; > NSURL *scriptsFolder = [[NSFileManager defaultManager] > URLForDirectory:NSApplicationScriptsDirectory inDomain:NSUserDomainMask > appropriateForURL:nil create:YES error:&error] > > This works fine if the scripts subfolder already exists. However, it if > doesn't, the application can't create it. If I pass "NO" as fourth parameter > I get back the url, but it's useless (it contains only the path), since the > folder is nonexistent. If I pass "YES" as fourth parameter, so that the > folder is created if necessary, I get the following error: > > Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save > the file “com.mydomain.myapp” in the folder “Application Scripts”.” UserInfo > {NSFilePath=/Users/milke/Library/Application Scripts/com.mydomain.myapp, > NSUnderlyingError=0x608000259bf0 {Error Domain=NSPOSIXErrorDomain Code=1 > "Operation not permitted"}}
You will get that error if your app isn't correctly code-signed. > The application also tries to be friendly to users and offers them to > "install" predefined scripts (bundled in the application package) into that > folder. Your app can't do that -- scripts can only be installed in that folder by the user. -- Shane Stanley <[email protected]> <www.macosxautomation.com/applescript/apps/>, <latenightsw.com> _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
