Reputation: 4945
In my project i'm creating a file using the function:
- (BOOL)createFileAtPath:(NSString *)path contents:(NSData *)data attributes:(NSDictionary *)attr;
I want to grant this file permissions so only the user can read and write (-rw------). I cant figure out (or find documentation) how i should fill this attribute dictionary (keys and values).
Thanks in advance
Upvotes: 1
Views: 604
Reputation: 122458
It's not clear what you expect to gain from this, but the syntax is:
NSDictionary *attributes = @{
NSFilePosixPermissions : @((short)(0x600))
};
BOOL created = [[NSFileManager defaultManager] createFileAtPath:path
contents:data
attributes:attributes];
Not sure if you actually need the (short)
cast or not.
Upvotes: 1