[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:51:24 CEST 2012


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

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

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

 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 41e6381..a7799c4 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