[Sandbox Broker] Allow to be passed directory URLs
Allow opening directory URLs as-is, rather than treating them like files. Return the full path if the caller requests opening on a directory. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
a1ab3deec4
commit
4ac566c308
1 changed files with 8 additions and 0 deletions
|
@ -30,6 +30,14 @@ static SandboxBroker *__sharedSandboxBroker = nil;
|
|||
@end
|
||||
|
||||
static NSURL *urlWithoutFragment(NSURL *u) {
|
||||
if(![u isFileURL]) return u;
|
||||
|
||||
NSNumber *isDirectory;
|
||||
|
||||
BOOL success = [u getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
|
||||
|
||||
if(success && [isDirectory boolValue]) return u;
|
||||
|
||||
NSString *s = [u path];
|
||||
|
||||
NSString *lastComponent = [u lastPathComponent];
|
||||
|
|
Loading…
Reference in a new issue