• 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
File Permissions - NSFileManager Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

File Permissions - NSFileManager Swift


  • Subject: File Permissions - NSFileManager Swift
  • From: Arved von Brasch <email@hidden>
  • Date: Mon, 29 Jun 2015 21:13:10 +1000

Dear Cocoa List,

I’m trying to remove an application package using

NSFileManager.defaultManager().removeItemAtPath(self.appPackage, error: &error)

The application package was put at this location using

NSFileManager.defaultManager().copyItemAtURL(pathURL as! NSURL, toURL: self.appPackage, error: &error)

However, when I trigger the code that should remove the application package, I get an error that I don’t have the right permissions to delete the application package.  The application package is in the user’s space and appears to have the correct permissions if I use “Get Info” on it in the Finder.

I also tried setting the file’s permissions directly with

NSFileManager.defaultManager().setAttributes([NSFilePosixPermissions: 0o777], ofItemAtPath: self.appPackage.path, error: &error)

This does seem to correctly modify the file’s permissions, in particular I can see the “Everybody” setting change from “Read Only” to “Read Write”, but the application package still can’t be deleted.

I’ve also tried copying the application package directly to the Desktop and then deleting it from there. That doesn’t work either.

Can anyone tell me what I’m doing wrong here?

Thank you,
Arved
_______________________________________________

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: File Permissions - NSFileManager Swift
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: NSUserDefaults allocation size and CALayer memory usage
  • Next by Date: Subclassing a Subclass of SBApplication
  • Previous by thread: Re: Swift 2.0 difficulty
  • Next by thread: Re: File Permissions - NSFileManager Swift
  • Index(es):
    • Date
    • Thread