electron/shell/common/electron_command_line.cc

37 lines
964 B
C++
Raw Normal View History

// 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 "shell/common/electron_command_line.h"
2015-06-19 14:56:10 +00:00
#include "base/command_line.h"
#include "uv.h" // NOLINT(build/include)
namespace electron {
2015-03-29 11:59:16 +00:00
// static
base::CommandLine::StringVector ElectronCommandLine::argv_;
2016-06-02 10:49:36 +00:00
// static
void ElectronCommandLine::Init(int argc, base::CommandLine::CharType** argv) {
DCHECK(argv_.empty());
2016-06-02 10:49:36 +00: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 13:50:21 +00:00
// Hack around with the argv pointer. Used for process.title = "blah"
argv = uv_setup_args(argc, argv);
#endif
argv_.assign(argv, argv + argc);
2016-06-02 10:49:36 +00:00
}
2015-06-19 14:56:10 +00:00
#if defined(OS_LINUX)
// static
void ElectronCommandLine::InitializeFromCommandLine() {
2015-06-19 14:56:10 +00:00
argv_ = base::CommandLine::ForCurrentProcess()->argv();
}
#endif
} // namespace electron