atom_command_line.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_ATOM_COMMAND_LINE_H_
  5. #define ATOM_COMMON_ATOM_COMMAND_LINE_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/macros.h"
  9. #include "build/build_config.h"
  10. namespace atom {
  11. // Singleton to remember the original "argc" and "argv".
  12. class AtomCommandLine {
  13. public:
  14. static void Init(int argc, const char* const* argv);
  15. static std::vector<std::string> argv() { return argv_; }
  16. #if defined(OS_WIN)
  17. static void InitW(int argc, const wchar_t* const* argv);
  18. static std::vector<std::wstring> wargv() { return wargv_; }
  19. #endif
  20. #if defined(OS_LINUX)
  21. // On Linux the command line has to be read from base::CommandLine since
  22. // it is using zygote.
  23. static void InitializeFromCommandLine();
  24. #endif
  25. private:
  26. static std::vector<std::string> argv_;
  27. #if defined(OS_WIN)
  28. static std::vector<std::wstring> wargv_;
  29. #endif
  30. DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine);
  31. };
  32. } // namespace atom
  33. #endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_