From 36682451639dea4846357c78e316eb2f9fa51e2b Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Mon, 13 Apr 2020 12:50:50 +0700 Subject: [PATCH] =?UTF-8?q?Convert=20to=20reference=20URL=20for=20file=20b?= =?UTF-8?q?rowser=E2=80=99s=20=E2=80=9CSelect=20Current=20Document?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes problems with symbolic links, for example file browser may show contents of /private/tmp when we ask to select /tmp/foo.txt. Comparing file path URLs will fail even though /tmp is a symbolic link for /private/tmp. Note that this fix only works for when the current document is already part of the items in the file browser, as we still store pending URLs to select as file path URLs. --- Frameworks/FileBrowser/src/FileBrowserViewController.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Frameworks/FileBrowser/src/FileBrowserViewController.mm b/Frameworks/FileBrowser/src/FileBrowserViewController.mm index e5a08f94..1e9b28a8 100644 --- a/Frameworks/FileBrowser/src/FileBrowserViewController.mm +++ b/Frameworks/FileBrowser/src/FileBrowserViewController.mm @@ -1196,10 +1196,12 @@ static NSMutableIndexSet* MutableLongestCommonSubsequence (NSArray* lhs, NSArray - (void)selectURL:(NSURL*)url withParentURL:(NSURL*)parentURL { + url = url.fileReferenceURL; + for(NSInteger i = 0; i < self.outlineView.numberOfRows; ++i) { FileItem* item = [self.outlineView itemAtRow:i]; - if([url isEqual:item.URL]) + if([url isEqual:item.fileReferenceURL]) { [self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; [self centerSelectionInVisibleArea:self];