[Path Config] Properly report broken bookmarks

Broken bookmarks weren't reporting as isStale, but rather, were failing
to resolve at all, and without this change, they were impossible to
detect in a migrated configuration.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-07-05 23:45:46 -07:00
parent ab285417ae
commit 0e2bfeb671
1 changed files with 1 additions and 5 deletions

View File

@ -44,11 +44,7 @@
BOOL isStale = YES;
NSError *err = nil;
NSURL *bookmarkUrl = [NSURL URLByResolvingBookmarkData:token.bookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:&isStale error:&err];
if(!bookmarkUrl) {
ALog(@"Stale bookmark for path: %@, with error: %@", token.path, [err localizedDescription]);
continue;
}
[self addObject:@{ @"path": token.path, @"valid": (isStale ? NSLocalizedPrefString(@"ValidNo") : NSLocalizedPrefString(@"ValidYes")), @"isFolder": @(token.folder) }];
[self addObject:@{ @"path": token.path, @"valid": ((!bookmarkUrl || isStale) ? NSLocalizedPrefString(@"ValidNo") : NSLocalizedPrefString(@"ValidYes")), @"isFolder": @(token.folder), @"token": token }];
}
}
}