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 <jas...@gmail.com> 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      (Filesystem-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/filesystem-dev/luther.j%40apple.com
> 
> This email sent to luthe...@apple.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

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

Reply via email to