Merge pull request #898 from paulcbetts/dont-hardcode-atom-helper
Dont hardcode paths to Atom [Helper / Framework]
This commit is contained in:
commit
7fdd94520e
6 changed files with 36 additions and 44 deletions
1
atom.gyp
1
atom.gyp
|
@ -58,7 +58,6 @@
|
||||||
'atom/app/atom_content_client.h',
|
'atom/app/atom_content_client.h',
|
||||||
'atom/app/atom_main_delegate.cc',
|
'atom/app/atom_main_delegate.cc',
|
||||||
'atom/app/atom_main_delegate.h',
|
'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.cc',
|
||||||
'atom/browser/api/atom_api_app.h',
|
'atom/browser/api/atom_api_app.h',
|
||||||
'atom/browser/api/atom_api_auto_updater.cc',
|
'atom/browser/api/atom_api_auto_updater.cc',
|
||||||
|
|
|
@ -26,10 +26,6 @@ class AtomMainDelegate : public brightray::MainDelegate {
|
||||||
scoped_ptr<brightray::ContentClient> CreateContentClient() override;
|
scoped_ptr<brightray::ContentClient> CreateContentClient() override;
|
||||||
void AddDataPackFromPath(
|
void AddDataPackFromPath(
|
||||||
ui::ResourceBundle* bundle, const base::FilePath& pak_dir) override;
|
ui::ResourceBundle* bundle, const base::FilePath& pak_dir) override;
|
||||||
#if defined(OS_MACOSX)
|
|
||||||
void OverrideChildProcessPath() override;
|
|
||||||
void OverrideFrameworkBundlePath() override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
brightray::ContentClient content_client_;
|
brightray::ContentClient content_client_;
|
||||||
|
|
|
@ -1,37 +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");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
void AtomMainDelegate::OverrideFrameworkBundlePath() {
|
|
||||||
base::mac::SetOverrideFrameworkBundlePath(
|
|
||||||
GetFrameworksPath().Append("Atom Framework.framework"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AtomMainDelegate::OverrideChildProcessPath() {
|
|
||||||
base::FilePath helper_path = GetFrameworksPath().Append("Atom Helper.app")
|
|
||||||
.Append("Contents")
|
|
||||||
.Append("MacOS")
|
|
||||||
.Append("Atom Helper");
|
|
||||||
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace atom
|
|
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
std::string GetApplicationName() {
|
||||||
|
std::string name = brightray::MainApplicationBundlePath().BaseName().AsUTF8Unsafe();
|
||||||
|
return name.substr(0, name.length() - 4/*.app*/);
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
// Initialize locale setting.
|
// Initialize locale setting.
|
||||||
l10n_util::OverrideLocaleWithCocoaLocale();
|
l10n_util::OverrideLocaleWithCocoaLocale();
|
||||||
|
@ -26,7 +31,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
base::FilePath frameworkPath = brightray::MainApplicationBundlePath()
|
base::FilePath frameworkPath = brightray::MainApplicationBundlePath()
|
||||||
.Append("Contents")
|
.Append("Contents")
|
||||||
.Append("Frameworks")
|
.Append("Frameworks")
|
||||||
.Append("Atom Framework.framework");
|
.Append(GetApplicationName() + " Framework.framework");
|
||||||
NSBundle* frameworkBundle = [NSBundle
|
NSBundle* frameworkBundle = [NSBundle
|
||||||
bundleWithPath:base::mac::FilePathToNSString(frameworkPath)];
|
bundleWithPath:base::mac::FilePathToNSString(frameworkPath)];
|
||||||
NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
|
NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
|
||||||
|
|
|
@ -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
|
atom-shell will start as your app. The `atom-shell` directory would then be
|
||||||
your distribution that should be delivered to final users.
|
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
|
## Packaging your app into a file
|
||||||
|
|
||||||
Apart from shipping your app by copying all its sources files, you can also
|
Apart from shipping your app by copying all its sources files, you can also
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 4f04cc8121dd05ed61a8c94edfa66201e12f0abb
|
Subproject commit f7bde923647448b1ae25fa4c1e3596d93febb7cf
|
Loading…
Reference in a new issue