[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>swiftingly
parent
a1ab3deec4
commit
4ac566c308
|
@ -30,6 +30,14 @@ static SandboxBroker *__sharedSandboxBroker = nil;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static NSURL *urlWithoutFragment(NSURL *u) {
|
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 *s = [u path];
|
||||||
|
|
||||||
NSString *lastComponent = [u lastPathComponent];
|
NSString *lastComponent = [u lastPathComponent];
|
||||||
|
|
Loading…
Reference in New Issue