From ae019409c5ebdac11e35cc9bce17a0dc3c505185 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 27 Jun 2022 16:17:19 -0700 Subject: [PATCH] [File Tree] Pop permission grant on setting root Setting the root path should now pop up a permission grant dialog. Signed-off-by: Christopher Snowhill --- FileTree/FileTreeDataSource.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FileTree/FileTreeDataSource.m b/FileTree/FileTreeDataSource.m index 3eea73def..5cd0b9efd 100644 --- a/FileTree/FileTreeDataSource.m +++ b/FileTree/FileTreeDataSource.m @@ -72,7 +72,11 @@ static NSURL *defaultMusicDirectory(void) { NSString *url = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]; DLog(@"File tree root URL: %@\n", url); - self.rootURL = [NSURL URLWithString:url]; + NSURL *newURL = [NSURL URLWithString:url]; + if((!self.rootURL || ![self.rootURL isEqualTo:newURL]) && ![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:@[newURL]]) { + [AppController globalShowPathSuggester]; + } + self.rootURL = newURL; } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; @@ -83,10 +87,6 @@ static NSURL *defaultMusicDirectory(void) { if(url != nil) { [[[NSUserDefaultsController sharedUserDefaultsController] defaults] setObject:[url absoluteString] forKey:@"fileTreeRootURL"]; - - if(![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:@[url]]) { - [AppController globalShowPathSuggester]; - } } }