Re: [ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
Re: [ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
- Subject: Re: [ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
- From: Jim Correia <email@hidden>
- Date: Sat, 30 May 2009 09:06:05 -0400
On Sat, May 30, 2009 at 1:39 AM, Erg Consultant <email@hidden>
wrote:
> Why does archiveRootObject:toFile: change the permissions on the parent
> directory? I didn't ask it to. This dir has to be writable for all users -
> the way I installed it - not by only the current user.
>
> How can I avoid having the permissions changed?
Show your code. In a trivial sample app here, this is not the behavior
I observe.
- JIm
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *outputFilePath =
[@"~/Desktop/output-parent/outputfile.keyedArchive"
stringByExpandingTildeInPath];
NSString *outputDir = [outputFilePath stringByDeletingLastPathComponent];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:
[NSNumber numberWithUnsignedInt: 0777] forKey:
NSFilePosixPermissions];
BOOL success = NO;
success = [[NSFileManager defaultManager] createDirectoryAtPath:
outputDir attributes: attributes];
success = [NSKeyedArchiver archiveRootObject: @"my object" toFile:
outputFilePath];
attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:
outputDir error: NULL];
NSLog(@"permissions = %o", [[attributes objectForKey:
NSFilePosixPermissions] unsignedIntValue]);
[pool drain];
return 0;
}
_______________________________________________
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