]> git.sesse.net Git - vlc/commitdiff
macosx: fixed custom revealInFinder implementation for files stored off the startup...
authorFelix Paul Kühne <fkuehne@videolan.org>
Thu, 21 Jun 2012 15:49:11 +0000 (17:49 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Thu, 21 Jun 2012 15:49:11 +0000 (17:49 +0200)
modules/gui/macosx/MainWindowTitle.m

index 41e6381b161b58097cdd996c3458aa05f6954145..a7799c4be64015bed37ab5c2deb87fdf5fdf3e52 100644 (file)
         [currentItem setImage: icon];
     }
 
-    if ([[pathComponents objectAtIndex: 1] isEqualToString:@"Users"]) {
-        /* we're on the boot drive, so add it is since it isn't part of the components */
+    if ([[pathComponents objectAtIndex: 1] isEqualToString:@"Volumes"]) {
+        /* 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:@""];
         currentItem = [contextMenu itemAtIndex: [contextMenu numberOfItems] - 1];
         icon = [[NSWorkspace sharedWorkspace] iconForFile:@"/"];
     NSMutableString * currentPath;
     currentPath = [NSMutableString stringWithCapacity:1024];
     selectedItem = count - selectedItem;
+
+    /* fix for non-startup volumes */
+    if ([[pathComponents objectAtIndex:1] isEqualToString:@"Volumes"])
+        selectedItem += 1;
+
     for (NSUInteger y = 1; y < selectedItem; y++)
         [currentPath appendFormat: @"/%@", [pathComponents objectAtIndex:y]];