2015-03-17 18:25:53 +05:30
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-02-04 12:19:40 -08:00
|
|
|
#include "shell/common/electron_command_line.h"
|
2015-06-19 22:56:10 +08:00
|
|
|
|
|
|
|
#include "base/command_line.h"
|
2020-04-25 04:57:41 +09:00
|
|
|
#include "uv.h" // NOLINT(build/include_directory)
|
2015-03-17 18:25:53 +05:30
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2015-03-17 18:25:53 +05:30
|
|
|
|
2015-03-29 19:59:16 +08:00
|
|
|
// static
|
2020-02-04 12:19:40 -08:00
|
|
|
base::CommandLine::StringVector ElectronCommandLine::argv_;
|
2015-03-29 19:53:47 +08:00
|
|
|
|
2016-06-02 19:49:36 +09:00
|
|
|
// static
|
2020-02-04 12:19:40 -08:00
|
|
|
void ElectronCommandLine::Init(int argc, base::CommandLine::CharType** argv) {
|
2018-01-22 16:49:30 -06:00
|
|
|
DCHECK(argv_.empty());
|
2016-06-02 19:49:36 +09:00
|
|
|
|
2018-01-22 16:49:30 -06:00
|
|
|
// NOTE: uv_setup_args does nothing on Windows, so we don't need to call it.
|
|
|
|
// Otherwise we'd have to convert the arguments from UTF16.
|
|
|
|
#if !defined(OS_WIN)
|
2015-04-04 19:20:21 +05:30
|
|
|
// Hack around with the argv pointer. Used for process.title = "blah"
|
2018-01-22 16:49:30 -06:00
|
|
|
argv = uv_setup_args(argc, argv);
|
|
|
|
#endif
|
2015-03-17 18:25:53 +05:30
|
|
|
|
2018-01-22 16:49:30 -06:00
|
|
|
argv_.assign(argv, argv + argc);
|
2016-06-02 19:49:36 +09:00
|
|
|
}
|
|
|
|
|
2015-06-19 22:56:10 +08:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
// static
|
2020-02-04 12:19:40 -08:00
|
|
|
void ElectronCommandLine::InitializeFromCommandLine() {
|
2015-06-19 22:56:10 +08:00
|
|
|
argv_ = base::CommandLine::ForCurrentProcess()->argv();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|