]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Makes sure MainMenu.nib is alwasys loaded from Atom.framework.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 12 Sep 2013 09:16:33 +0000 (17:16 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 12 Sep 2013 09:16:33 +0000 (17:16 +0800)
browser/atom_browser_main_parts_mac.mm

index d518c0fa70b94dd603252fa105fb8e2de271a5e3..cf2b0c7a4c1511fec02eddd0e0c07b368f98d7d1 100644 (file)
@@ -4,9 +4,11 @@
 
 #include "browser/atom_browser_main_parts.h"
 
-#import "base/mac/bundle_locations.h"
+#include "base/files/file_path.h"
+#import "base/mac/foundation_util.h"
 #import "browser/atom_application_mac.h"
 #import "browser/atom_application_delegate_mac.h"
+#import "vendor/brightray/common/mac/main_application_bundle.h"
 
 namespace atom {
 
@@ -17,10 +19,12 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
   AtomApplicationDelegate* delegate = [AtomApplicationDelegate alloc];
   [NSApp setDelegate:delegate];
 
-  auto infoDictionary = base::mac::OuterBundle().infoDictionary;
-
-  NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
-  auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:base::mac::FrameworkBundle()];
+  base::FilePath frameworkPath = brightray::MainApplicationBundlePath()
+      .Append("Contents").Append("Frameworks").Append("Atom.framework");
+  NSBundle* frameworkBundle = [NSBundle
+       bundleWithPath:base::mac::FilePathToNSString(frameworkPath)];
+  NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
+                                            bundle:frameworkBundle];
   [mainNib instantiateWithOwner:application topLevelObjects:nil];
   [mainNib release];