[vlc-commits] macosx: fixed custom revealInFinder implementation for files stored off the startup volume

Felix Paul Kühne git at videolan.org
Thu Jun 21 17:54:37 CEST 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Jun 21 17:49:11 2012 +0200| [380e40213b2dcd8116bcc5efb8556a008aae42d8] | committer: Felix Paul Kühne

macosx: fixed custom revealInFinder implementation for files stored off the startup volume
(cherry picked from commit cac887503093923b11a0240490aed69c09152262)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=380e40213b2dcd8116bcc5efb8556a008aae42d8
---

 modules/gui/macosx/MainWindowTitle.m |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/MainWindowTitle.m b/modules/gui/macosx/MainWindowTitle.m
index 3d77d31..0c9091e 100644
--- a/modules/gui/macosx/MainWindowTitle.m
+++ b/modules/gui/macosx/MainWindowTitle.m
@@ -506,8 +506,13 @@
         [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:@"/"];
@@ -559,6 +564,11 @@
     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]];
 



More information about the vlc-commits mailing list