atom_command_line.h 947 B

123456789101112131415161718192021222324252627282930313233343536373839
  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/command_line.h"
  9. #include "base/macros.h"
  10. #include "build/build_config.h"
  11. namespace atom {
  12. // Singleton to remember the original "argc" and "argv".
  13. class AtomCommandLine {
  14. public:
  15. static const base::CommandLine::StringVector& argv() { return argv_; }
  16. static void Init(int argc, base::CommandLine::CharType** argv);
  17. #if defined(OS_LINUX)
  18. // On Linux the command line has to be read from base::CommandLine since
  19. // it is using zygote.
  20. static void InitializeFromCommandLine();
  21. #endif
  22. private:
  23. static base::CommandLine::StringVector argv_;
  24. DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine);
  25. };
  26. } // namespace atom
  27. #endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_