]> khamidou — GitHub mirrors - electron.git/commitdiff
Determine the Helper name from the App name
authorPaul Betts <paul@paulbetts.org>
Sat, 6 Dec 2014 07:01:03 +0000 (23:01 -0800)
committerPaul Betts <paul@paulbetts.org>
Sat, 6 Dec 2014 07:19:19 +0000 (23:19 -0800)
atom/app/atom_main_delegate_mac.mm

index 9795ee459c7bd06e0a1d462a97a0d085112054e1..856f510a439d1bd32e88d5236127c4f43b078677 100644 (file)
@@ -19,18 +19,28 @@ base::FilePath GetFrameworksPath() {
                                                .Append("Frameworks");
 }
 
+std::string GetApplicationName() {
+  std::string name = brightray::MainApplicationBundlePath().BaseName().AsUTF8Unsafe();
+  return name.substr(0, name.length() - 4/*.app*/);
+}
+
 }  // namespace
 
 void AtomMainDelegate::OverrideFrameworkBundlePath() {
-  base::mac::SetOverrideFrameworkBundlePath(
-      GetFrameworksPath().Append("Atom Framework.framework"));
+  base::FilePath bundlePath = GetFrameworksPath();
+  std::string app_name = GetApplicationName();
+
+  base::mac::SetOverrideFrameworkBundlePath(bundlePath
+      .Append(app_name + " Framework.framework"));
 }
 
 void AtomMainDelegate::OverrideChildProcessPath() {
-  base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app")
+  std::string app_name = GetApplicationName();
+
+  base::FilePath helper_path = GetFrameworksPath().Append(app_name + " Helper.app")
                                                   .Append("Contents")
                                                   .Append("MacOS")
-                                                  .Append("Atom Helper");
+                                                  .Append(app_name + " Helper");
   PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
 }