• 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: [ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: [ NSKeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
      • From: Erg Consultant <email@hidden>
References: 
 >[ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions (From: Erg Consultant <email@hidden>)

  • Prev by Date: Re: Showing more warnings possible in Xcode?
  • Next by Date: Modeling "Smart Playlists"
  • Previous by thread: [ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
  • Next by thread: Re: [ NSKeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions
  • Index(es):
    • Date
    • Thread