2015-03-17 12:55:53 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-06-19 15:11:53 +00:00
|
|
|
#include "atom/common/atom_command_line.h"
|
2015-06-19 14:56:10 +00:00
|
|
|
|
|
|
|
#include "base/command_line.h"
|
|
|
|
#include "node/deps/uv/include/uv.h"
|
2015-03-17 12:55:53 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
2015-03-29 11:59:16 +00:00
|
|
|
// static
|
|
|
|
std::vector<std::string> AtomCommandLine::argv_;
|
2015-03-29 11:53:47 +00:00
|
|
|
|
2015-03-29 11:59:16 +00:00
|
|
|
// static
|
|
|
|
void AtomCommandLine::Init(int argc, const char* const* argv) {
|
2015-04-04 13:50:21 +00:00
|
|
|
// Hack around with the argv pointer. Used for process.title = "blah"
|
|
|
|
char** new_argv = uv_setup_args(argc, const_cast<char**>(argv));
|
2015-03-29 11:59:16 +00:00
|
|
|
for (int i = 0; i < argc; ++i) {
|
2015-04-04 13:50:21 +00:00
|
|
|
argv_.push_back(new_argv[i]);
|
2015-03-29 11:59:16 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-17 12:55:53 +00:00
|
|
|
|
2015-06-19 14:56:10 +00:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
// static
|
|
|
|
void AtomCommandLine::InitializeFromCommandLine() {
|
|
|
|
argv_ = base::CommandLine::ForCurrentProcess()->argv();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-17 12:55:53 +00:00
|
|
|
} // namespace atom
|