Commit 380e4021 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed custom revealInFinder implementation for files stored off the startup volume

(cherry picked from commit cac887503093923b11a0240490aed69c09152262)
parent a168e79b
...@@ -506,8 +506,13 @@ ...@@ -506,8 +506,13 @@
[currentItem setImage: icon]; [currentItem setImage: icon];
} }
if ([[pathComponents objectAtIndex: 1] isEqualToString:@"Users"]) { if ([[pathComponents objectAtIndex: 1] isEqualToString:@"Volumes"]) {
/* we're on the boot drive, so add it is since it isn't part of the components */ /* we don't want to show the Volumes item, since the Cocoa does it neither */
currentItem = [contextMenu itemWithTitle:[[NSFileManager defaultManager] displayNameAtPath: @"/Volumes"]];
if (currentItem)
[contextMenu removeItem: currentItem];
} else {
/* we're on the boot drive, so add it since it isn't part of the components */
[contextMenu addItemWithTitle: [[NSFileManager defaultManager] displayNameAtPath:@"/"] action:@selector(revealInFinder:) keyEquivalent:@""]; [contextMenu addItemWithTitle: [[NSFileManager defaultManager] displayNameAtPath:@"/"] action:@selector(revealInFinder:) keyEquivalent:@""];
currentItem = [contextMenu itemAtIndex: [contextMenu numberOfItems] - 1]; currentItem = [contextMenu itemAtIndex: [contextMenu numberOfItems] - 1];
icon = [[NSWorkspace sharedWorkspace] iconForFile:@"/"]; icon = [[NSWorkspace sharedWorkspace] iconForFile:@"/"];
...@@ -559,6 +564,11 @@ ...@@ -559,6 +564,11 @@
NSMutableString * currentPath; NSMutableString * currentPath;
currentPath = [NSMutableString stringWithCapacity:1024]; currentPath = [NSMutableString stringWithCapacity:1024];
selectedItem = count - selectedItem; selectedItem = count - selectedItem;
/* fix for non-startup volumes */
if ([[pathComponents objectAtIndex:1] isEqualToString:@"Volumes"])
selectedItem += 1;
for (NSUInteger y = 1; y < selectedItem; y++) for (NSUInteger y = 1; y < selectedItem; y++)
[currentPath appendFormat: @"/%@", [pathComponents objectAtIndex:y]]; [currentPath appendFormat: @"/%@", [pathComponents objectAtIndex:y]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment