[Sandbox] Handle file tree path config better

Handle the configuration better, by adding the path to the grants list
if it is newly configured.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-06-29 00:31:34 -07:00
parent f5bde75eda
commit 3ef6a4204f
3 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,8 @@
}
- (void)updatePath {
if(!url) return;
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles)

View File

@ -74,7 +74,7 @@ static NSURL *defaultMusicDirectory(void) {
DLog(@"File tree root URL: %@\n", url);
NSURL *newURL = [NSURL URLWithString:url];
if((!self.rootURL || ![self.rootURL isEqualTo:newURL]) && ![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:@[newURL]]) {
[AppController globalShowPathSuggester];
[[SandboxBroker sharedSandboxBroker] addFolderIfMissing:newURL];
}
self.rootURL = newURL;
}

View File

@ -44,6 +44,8 @@ const FSEventStreamEventId eventIds[]) {
- (void)setPath:(NSString *)path {
[self cleanUp];
if(!path) return;
// Create FSEvent stream
NSArray *pathsToWatch = @[path];