File Permissions - NSFileManager Swift
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