Compare commits
5 commits
f7c6cd2900
...
cc2641f1f7
Author | SHA1 | Date | |
---|---|---|---|
|
cc2641f1f7 | ||
|
bfd2aee33c | ||
|
86be50cc02 | ||
|
d751dca10b | ||
|
41780e88d0 |
2 changed files with 31 additions and 2 deletions
|
@ -45,10 +45,27 @@
|
|||
|
||||
if(results && [results count] > 0) {
|
||||
for(SandboxToken *token in results) {
|
||||
BOOL isDisconnected = NO;
|
||||
BOOL isStale = YES;
|
||||
NSError *err = nil;
|
||||
{
|
||||
NSDictionary *dict = [NSURL resourceValuesForKeys:@[NSURLVolumeURLKey] fromBookmarkData:token.bookmark];
|
||||
if(dict) {
|
||||
NSURL *volumeUrl = dict[NSURLVolumeURLKey];
|
||||
if(volumeUrl && [volumeUrl isFileURL] && [volumeUrl path]) {
|
||||
if(![[NSFileManager defaultManager] fileExistsAtPath:[volumeUrl path]]) {
|
||||
isDisconnected = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isDisconnected) {
|
||||
NSURL *bookmarkUrl = [NSURL URLByResolvingBookmarkData:token.bookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:&isStale error:&err];
|
||||
[self addObject:@{ @"path": token.path, @"valid": ((!bookmarkUrl || isStale) ? NSLocalizedPrefString(@"ValidNo") : NSLocalizedPrefString(@"ValidYes")), @"isFolder": @(token.folder), @"token": token }];
|
||||
} else {
|
||||
[self addObject:@{ @"path": token.path, @"valid": NSLocalizedPrefString(@"ValidNo"), @"isFolder": @(token.folder), @"token": token }];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,6 +192,18 @@ static SandboxBroker *kSharedSandboxBroker = nil;
|
|||
}
|
||||
}];
|
||||
|
||||
if(ret) {
|
||||
NSDictionary *dict = [NSURL resourceValuesForKeys:@[NSURLVolumeURLKey] fromBookmarkData:ret.token.bookmark];
|
||||
if(dict) {
|
||||
NSURL *volumeUrl = dict[NSURLVolumeURLKey];
|
||||
if(volumeUrl && [volumeUrl isFileURL] && [volumeUrl path]) {
|
||||
if(![[NSFileManager defaultManager] fileExistsAtPath:[volumeUrl path]]) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ret) {
|
||||
BOOL isStale;
|
||||
NSError *err = nil;
|
||||
|
|
Loading…
Reference in a new issue