I'm guessing TextEdit is using NSURLIsWritableKey like this: NSURL *url = "">NSURL fileURLWithPath:@"/System/" isDirectory:YES]; // "/System/" isn't writable for most users NSError *error; NSNumber *isWritable = nil; if ( [url getResourceValue:&isWritable forKey:NSURLIsWritableKey error:&error] ) { NSLog(@"%@ is %@writable", url, [isWritable boolValue] ? @"" : @"not "); } else { NSLog(@"Error: %@", error); }The NSURLIsWritableKey property reflects W_OK bit in the effective permissions of the current user as returned by access(2) or getattrlist(2) with the ATTR_CMN_USERACCESS attribute.On Sep 1, 2016, at 2:44 PM, Jeff Schindler <email@hidden> wrote:Hi,I am accessing a file from a Windows server over SMB. The file has an ACL applied to it on the Windows side such that it is effectively read-only. SMB seems to pick this up, as the associated app (TextEdit) says that the file is locked, but I'm trying to figure out how I can determine the read-only state of that file on the Mac side myself, either from code or the command line. Based on what I see, it does not have the com.apple.system.Security extended attribute applied to it (I *think* you should be able to see that via "ls -ahel@"), and the normal posix permissions don't reflect its read-only state, so I'm trying to figure out how TextEdit is picking that up, and how I might do the same from code.Thanks!Jeff _______________________________________________ Do not post admin requests to the list. They will be ignored. Filesystem-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden References: >SMB and ACLs (From: Jeff Schindler <email@hidden>) >Re: SMB and ACLs (From: Jim Luther <email@hidden>) Prev by Date: Re: SMB and ACLs Next by Date: future of printf in kext Previous by thread: Re: SMB and ACLs Next by thread: future of printf in kext Index(es): Date Thread
On Sep 1, 2016, at 2:44 PM, Jeff Schindler <email@hidden> wrote:Hi,I am accessing a file from a Windows server over SMB. The file has an ACL applied to it on the Windows side such that it is effectively read-only. SMB seems to pick this up, as the associated app (TextEdit) says that the file is locked, but I'm trying to figure out how I can determine the read-only state of that file on the Mac side myself, either from code or the command line. Based on what I see, it does not have the com.apple.system.Security extended attribute applied to it (I *think* you should be able to see that via "ls -ahel@"), and the normal posix permissions don't reflect its read-only state, so I'm trying to figure out how TextEdit is picking that up, and how I might do the same from code.Thanks!Jeff _______________________________________________ Do not post admin requests to the list. They will be ignored. Filesystem-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden References: >SMB and ACLs (From: Jeff Schindler <email@hidden>) >Re: SMB and ACLs (From: Jim Luther <email@hidden>) Prev by Date: Re: SMB and ACLs Next by Date: future of printf in kext Previous by thread: Re: SMB and ACLs Next by thread: future of printf in kext Index(es): Date Thread
_______________________________________________ Do not post admin requests to the list. They will be ignored. Filesystem-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden