atom_command_line.cc 939 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/common/atom_command_line.h"
  5. #include "base/command_line.h"
  6. #include "uv.h" // NOLINT(build/include)
  7. namespace atom {
  8. // static
  9. base::CommandLine::StringVector AtomCommandLine::argv_;
  10. // static
  11. void AtomCommandLine::Init(int argc, base::CommandLine::CharType** argv) {
  12. DCHECK(argv_.empty());
  13. // NOTE: uv_setup_args does nothing on Windows, so we don't need to call it.
  14. // Otherwise we'd have to convert the arguments from UTF16.
  15. #if !defined(OS_WIN)
  16. // Hack around with the argv pointer. Used for process.title = "blah"
  17. argv = uv_setup_args(argc, argv);
  18. #endif
  19. argv_.assign(argv, argv + argc);
  20. }
  21. #if defined(OS_LINUX)
  22. // static
  23. void AtomCommandLine::InitializeFromCommandLine() {
  24. argv_ = base::CommandLine::ForCurrentProcess()->argv();
  25. }
  26. #endif
  27. } // namespace atom