2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-04-12 01:46:58 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-24 08:45:59 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
#include "shell/app/electron_library_main.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2015-03-13 01:26:10 +00:00
|
|
|
#include "base/at_exit.h"
|
2015-01-16 23:54:38 +00:00
|
|
|
#include "base/i18n/icu_util.h"
|
|
|
|
#include "base/mac/bundle_locations.h"
|
2015-10-20 23:34:15 +00:00
|
|
|
#include "base/mac/scoped_nsautorelease_pool.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
#include "content/public/app/content_main.h"
|
2020-10-27 17:49:25 +00:00
|
|
|
#include "electron/fuses.h"
|
2020-02-04 20:19:40 +00:00
|
|
|
#include "shell/app/electron_main_delegate.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/app/node_main.h"
|
2020-02-04 20:19:40 +00:00
|
|
|
#include "shell/common/electron_command_line.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/mac/main_application_bundle.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
int ElectronMain(int argc, char* argv[]) {
|
|
|
|
electron::ElectronMainDelegate delegate;
|
2014-06-30 03:44:05 +00:00
|
|
|
content::ContentMainParams params(&delegate);
|
|
|
|
params.argc = argc;
|
2018-01-22 22:49:30 +00:00
|
|
|
params.argv = const_cast<const char**>(argv);
|
2020-02-04 20:19:40 +00:00
|
|
|
electron::ElectronCommandLine::Init(argc, argv);
|
2021-11-24 08:45:59 +00:00
|
|
|
return content::ContentMain(std::move(params));
|
2013-04-12 01:46:58 +00:00
|
|
|
}
|
2015-01-16 23:54:38 +00:00
|
|
|
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
|
2020-02-04 20:19:40 +00:00
|
|
|
int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
|
2020-10-27 17:49:25 +00:00
|
|
|
if (!electron::fuses::IsRunAsNodeEnabled()) {
|
|
|
|
CHECK(false) << "run_as_node fuse is disabled";
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-03-13 01:26:10 +00:00
|
|
|
base::AtExitManager atexit_manager;
|
2015-10-20 23:34:15 +00:00
|
|
|
base::mac::ScopedNSAutoreleasePool pool;
|
2015-01-16 23:54:38 +00:00
|
|
|
base::mac::SetOverrideFrameworkBundlePath(
|
2019-06-19 21:23:04 +00:00
|
|
|
electron::MainApplicationBundlePath()
|
2015-01-16 23:54:38 +00:00
|
|
|
.Append("Contents")
|
|
|
|
.Append("Frameworks")
|
2019-06-17 20:37:55 +00:00
|
|
|
.Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
|
2015-01-16 23:54:38 +00:00
|
|
|
base::i18n::InitializeICU();
|
2019-06-19 21:23:04 +00:00
|
|
|
return electron::NodeMain(argc, argv);
|
2015-01-16 23:54:38 +00:00
|
|
|
}
|
2018-03-09 09:51:09 +00:00
|
|
|
#endif
|