refactor: eliminate duplicate C++ / JavaScript implementation of app.isPackaged (#29464)
This commit is contained in:
parent
f0d3e1d1cf
commit
44491b023a
4 changed files with 19 additions and 22 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "shell/browser/api/electron_api_app.h"
|
||||
#include "shell/common/api/electron_bindings.h"
|
||||
#include "shell/common/electron_command_line.h"
|
||||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
|
@ -130,19 +131,6 @@ void stop_and_close_uv_loop(uv_loop_t* loop) {
|
|||
|
||||
bool g_is_initialized = false;
|
||||
|
||||
bool IsPackagedApp() {
|
||||
base::FilePath exe_path;
|
||||
base::PathService::Get(base::FILE_EXE, &exe_path);
|
||||
base::FilePath::StringType base_name =
|
||||
base::ToLowerASCII(exe_path.BaseName().value());
|
||||
|
||||
#if defined(OS_WIN)
|
||||
return base_name != FILE_PATH_LITERAL("electron.exe");
|
||||
#else
|
||||
return base_name != FILE_PATH_LITERAL("electron");
|
||||
#endif
|
||||
}
|
||||
|
||||
void V8FatalErrorCallback(const char* location, const char* message) {
|
||||
LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
|
||||
|
||||
|
@ -257,7 +245,7 @@ void SetNodeOptions(base::Environment* env) {
|
|||
std::vector<std::string> parts = base::SplitString(
|
||||
options, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
||||
|
||||
bool is_packaged_app = IsPackagedApp();
|
||||
bool is_packaged_app = electron::api::App::IsPackaged();
|
||||
|
||||
for (const auto& part : parts) {
|
||||
// Strip off values passed to individual NODE_OPTIONs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue