From 3d4491a4682a779f21232e08255d6fdaede04cc8 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Fri, 5 Dec 2014 23:01:03 -0800 Subject: [PATCH 1/6] Determine the Helper name from the App name --- atom/app/atom_main_delegate_mac.mm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/atom/app/atom_main_delegate_mac.mm b/atom/app/atom_main_delegate_mac.mm index 9795ee459c7..856f510a439 100644 --- a/atom/app/atom_main_delegate_mac.mm +++ b/atom/app/atom_main_delegate_mac.mm @@ -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); } From 091357ad8e5b8bedac3c61026afd96190861bb20 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Fri, 5 Dec 2014 23:19:05 -0800 Subject: [PATCH 2/6] Find the MainMenu nib correctly --- atom/browser/atom_browser_main_parts_mac.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/browser/atom_browser_main_parts_mac.mm b/atom/browser/atom_browser_main_parts_mac.mm index d31dde15dd6..c1a9eae3147 100644 --- a/atom/browser/atom_browser_main_parts_mac.mm +++ b/atom/browser/atom_browser_main_parts_mac.mm @@ -13,6 +13,11 @@ namespace atom { +std::string GetApplicationName() { + std::string name = brightray::MainApplicationBundlePath().BaseName().AsUTF8Unsafe(); + return name.substr(0, name.length() - 4/*.app*/); +} + void AtomBrowserMainParts::PreMainMessageLoopStart() { // Initialize locale setting. l10n_util::OverrideLocaleWithCocoaLocale(); @@ -26,7 +31,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() { base::FilePath frameworkPath = brightray::MainApplicationBundlePath() .Append("Contents") .Append("Frameworks") - .Append("Atom Framework.framework"); + .Append(GetApplicationName() + " Framework.framework"); NSBundle* frameworkBundle = [NSBundle bundleWithPath:base::mac::FilePathToNSString(frameworkPath)]; NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu" From 8eab230fe11250413f4ecc708eb3212c84385e1b Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Sun, 7 Dec 2014 21:06:47 -0800 Subject: [PATCH 3/6] Delete OverrideChildProcessPath and OverrideFrameworkBundlePath altogether --- atom.gyp | 1 - atom/app/atom_main_delegate.h | 4 --- atom/app/atom_main_delegate_mac.mm | 47 ------------------------------ 3 files changed, 52 deletions(-) delete mode 100644 atom/app/atom_main_delegate_mac.mm diff --git a/atom.gyp b/atom.gyp index e3c9eeab71c..3b607589a12 100644 --- a/atom.gyp +++ b/atom.gyp @@ -58,7 +58,6 @@ 'atom/app/atom_content_client.h', 'atom/app/atom_main_delegate.cc', 'atom/app/atom_main_delegate.h', - 'atom/app/atom_main_delegate_mac.mm', 'atom/browser/api/atom_api_app.cc', 'atom/browser/api/atom_api_app.h', 'atom/browser/api/atom_api_auto_updater.cc', diff --git a/atom/app/atom_main_delegate.h b/atom/app/atom_main_delegate.h index 8cd4a28ee1c..9f74386304a 100644 --- a/atom/app/atom_main_delegate.h +++ b/atom/app/atom_main_delegate.h @@ -26,10 +26,6 @@ class AtomMainDelegate : public brightray::MainDelegate { scoped_ptr CreateContentClient() override; void AddDataPackFromPath( ui::ResourceBundle* bundle, const base::FilePath& pak_dir) override; -#if defined(OS_MACOSX) - void OverrideChildProcessPath() override; - void OverrideFrameworkBundlePath() override; -#endif private: brightray::ContentClient content_client_; diff --git a/atom/app/atom_main_delegate_mac.mm b/atom/app/atom_main_delegate_mac.mm deleted file mode 100644 index 856f510a439..00000000000 --- a/atom/app/atom_main_delegate_mac.mm +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2013 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#include "atom/app/atom_main_delegate.h" - -#include "base/mac/bundle_locations.h" -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "brightray/common/mac/main_application_bundle.h" -#include "content/public/common/content_paths.h" - -namespace atom { - -namespace { - -base::FilePath GetFrameworksPath() { - return brightray::MainApplicationBundlePath().Append("Contents") - .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::FilePath bundlePath = GetFrameworksPath(); - std::string app_name = GetApplicationName(); - - base::mac::SetOverrideFrameworkBundlePath(bundlePath - .Append(app_name + " Framework.framework")); -} - -void AtomMainDelegate::OverrideChildProcessPath() { - std::string app_name = GetApplicationName(); - - base::FilePath helper_path = GetFrameworksPath().Append(app_name + " Helper.app") - .Append("Contents") - .Append("MacOS") - .Append(app_name + " Helper"); - PathService::Override(content::CHILD_PROCESS_EXE, helper_path); -} - -} // namespace atom From d0f6c89e77dfdfb0389416522088797e225a230c Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Sun, 7 Dec 2014 21:26:13 -0800 Subject: [PATCH 4/6] Bump brightray to pick up brightray/brightray#85 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 4f04cc8121d..bfb26009141 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 4f04cc8121dd05ed61a8c94edfa66201e12f0abb +Subproject commit bfb26009141811255e3faa9f165cc962fd3ffc26 From e87876671f582914008e6c4773db42e17f6f5587 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Sun, 7 Dec 2014 21:38:29 -0800 Subject: [PATCH 5/6] Add some documentation about renaming Atom Shell --- docs/tutorial/application-distribution.md | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/tutorial/application-distribution.md b/docs/tutorial/application-distribution.md index 8258028f2f4..ff1030bbf7d 100644 --- a/docs/tutorial/application-distribution.md +++ b/docs/tutorial/application-distribution.md @@ -27,6 +27,35 @@ Then execute `Atom.app` (or `atom` on Linux, and `atom.exe` on Windows), and atom-shell will start as your app. The `atom-shell` directory would then be your distribution that should be delivered to final users. +## Renaming Atom Shell for your app + +The best way to rename Atom Shell is to change the `atom.gyp` file, then build +from source. Open up `atom.gyp` and change the first lines: + +``` +'project_name': 'atom', +'product_name': 'Atom', +'framework_name': 'Atom Framework', +``` + +Once you make the change, re-run `script/bootstrap` then run the command: + +```sh +script/build.py -c Release -t $whatever_you_chose_for_project_name +``` + +If your app is OS X / Linux-only, you can also simply rename the "Atom.app" +folder as well as the names under "Framework" (i.e. "Atom Framework.framework" +=> "MyApp Framework.framework"), but this will break loading native Node +modules on Windows. + +Fixing this is complicated, but a Grunt task has been created that will handle +this automatically, +[grunt-build-atom-shell](https://github.com/paulcbetts/grunt-build-atom-shell). +This task will automatically handle editing the .gyp file, building from +source, then rebuilding your app's native Node modules to match the new +executable name. + ## Packaging your app into a file Apart from shipping your app by copying all its sources files, you can also From aa3be09ab089bdf21b441afccadd66daa1f26c4f Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 8 Dec 2014 20:26:09 -0800 Subject: [PATCH 6/6] Bump submodule to merged version --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index bfb26009141..f7bde923647 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit bfb26009141811255e3faa9f165cc962fd3ffc26 +Subproject commit f7bde923647448b1ae25fa4c1e3596d93febb7cf