mac: Always use "Atom" as name when find helper process. Fixes #89.

This commit is contained in:
Cheng Zhao 2013-09-12 15:42:36 +08:00
parent f38eb1b66f
commit cec640f572

View file

@ -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);