On Sat, May 30, 2009 at 1:39 AM, Erg Consultant <erg_consult...@yahoo.com>
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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to