diff --git a/app/atom_main_delegate.cc b/app/atom_main_delegate.cc index 9eb81ba1d515..f868e270c2b8 100644 --- a/app/atom_main_delegate.cc +++ b/app/atom_main_delegate.cc @@ -10,6 +10,27 @@ #include "content/public/common/content_switches.h" #include "renderer/atom_renderer_client.h" +#if defined(OS_MACOSX) + +#include "base/mac/bundle_locations.h" +#include "base/path_service.h" +#include "content/public/common/content_paths.h" + +namespace brightray { +base::FilePath MainApplicationBundlePath(); +} + +namespace { + +base::FilePath GetFrameworksPath() { + return brightray::MainApplicationBundlePath().Append("Contents") + .Append("Frameworks"); +} + +} // namespace + +#endif // defined(OS_MACOSX) + namespace atom { AtomMainDelegate::AtomMainDelegate() { @@ -40,6 +61,16 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { void AtomMainDelegate::PreSandboxStartup() { brightray::MainDelegate::PreSandboxStartup(); +#if defined(OS_MACOSX) + // Override the path to helper process, since third party users may want to + // change the application name. + base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app") + .Append("Contents") + .Append("MacOS") + .Append("Atom Helper"); + PathService::Override(content::CHILD_PROCESS_EXE, helper_path); +#endif // defined(OS_MACOSX) + // Disable renderer sandbox for most of node's functions. CommandLine* command_line = CommandLine::ForCurrentProcess(); command_line->AppendSwitch(switches::kNoSandbox);