[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>swiftingly
parent
29c070a616
commit
1a4c140708
|
@ -20,6 +20,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updatePath {
|
- (void)updatePath {
|
||||||
|
if(!url) return;
|
||||||
|
|
||||||
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url
|
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url
|
||||||
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
|
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
|
||||||
options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles)
|
options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles)
|
||||||
|
|
|
@ -74,7 +74,7 @@ static NSURL *defaultMusicDirectory(void) {
|
||||||
DLog(@"File tree root URL: %@\n", url);
|
DLog(@"File tree root URL: %@\n", url);
|
||||||
NSURL *newURL = [NSURL URLWithString:url];
|
NSURL *newURL = [NSURL URLWithString:url];
|
||||||
if((!self.rootURL || ![self.rootURL isEqualTo:newURL]) && ![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:@[newURL]]) {
|
if((!self.rootURL || ![self.rootURL isEqualTo:newURL]) && ![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:@[newURL]]) {
|
||||||
[AppController globalShowPathSuggester];
|
[[SandboxBroker sharedSandboxBroker] addFolderIfMissing:newURL];
|
||||||
}
|
}
|
||||||
self.rootURL = newURL;
|
self.rootURL = newURL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ const FSEventStreamEventId eventIds[]) {
|
||||||
- (void)setPath:(NSString *)path {
|
- (void)setPath:(NSString *)path {
|
||||||
[self cleanUp];
|
[self cleanUp];
|
||||||
|
|
||||||
|
if(!path) return;
|
||||||
|
|
||||||
// Create FSEvent stream
|
// Create FSEvent stream
|
||||||
NSArray *pathsToWatch = @[path];
|
NSArray *pathsToWatch = @[path];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue