• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating "Application Scripts" subfolder in sandboxed environment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating "Application Scripts" subfolder in sandboxed environment


  • Subject: Re: Creating "Application Scripts" subfolder in sandboxed environment
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 09 Jun 2017 22:59:02 +1000

On 9 Jun 2017, at 10:13 pm, Dragan Milić <email@hidden> 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@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Creating "Application Scripts" subfolder in sandboxed environment
      • From: Dragan Milić <email@hidden>
References: 
 >Creating "Application Scripts" subfolder in sandboxed environment (From: Dragan Milić <email@hidden>)

  • Prev by Date: Creating "Application Scripts" subfolder in sandboxed environment
  • Next by Date: Re: Creating "Application Scripts" subfolder in sandboxed environment
  • Previous by thread: Creating "Application Scripts" subfolder in sandboxed environment
  • Next by thread: Re: Creating "Application Scripts" subfolder in sandboxed environment
  • Index(es):
    • Date
    • Thread