Convert to reference URL for file browser’s “Select Current Document”

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.
This commit is contained in:
Allan Odgaard
2020-04-13 12:50:50 +07:00
parent 3eaaff7f47
commit 3668245163

View File

@@ -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];