diff --git a/source/ps/GameSetup/CmdLineArgs.cpp b/source/ps/GameSetup/CmdLineArgs.cpp index 00a2bd4f0a..4138dd1bd3 100644 --- a/source/ps/GameSetup/CmdLineArgs.cpp +++ b/source/ps/GameSetup/CmdLineArgs.cpp @@ -112,6 +112,11 @@ OsPath CmdLineArgs::GetArg0() const return m_Arg0; } +const CmdLineArgs::ArgsT& CmdLineArgs::GetArgs() const +{ + return m_Args; +} + std::vector CmdLineArgs::GetArgsWithoutName() const { return m_ArgsWithoutName; @@ -123,7 +128,7 @@ template<> void Script::ToJSVal(const ScriptRequest& rq, JS::Mutabl return; std::unordered_map> args; - for (const std::pair& arg : val.m_Args) + for (const std::pair& arg : val.GetArgs()) args.emplace(arg.first, std::vector{}).first->second.emplace_back(arg.second); JS::RootedValue argVal(rq.cx); diff --git a/source/ps/GameSetup/CmdLineArgs.h b/source/ps/GameSetup/CmdLineArgs.h index 71fabe4b76..5b0e3aa10f 100644 --- a/source/ps/GameSetup/CmdLineArgs.h +++ b/source/ps/GameSetup/CmdLineArgs.h @@ -21,21 +21,18 @@ #include "lib/os_path.h" #include "ps/containers/Span.h" #include "ps/CStr.h" -#include "scriptinterface/ScriptTypes.h" #include #include class ScriptRequest; -namespace Script { -template -void ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret, const T& val); -} class CmdLineArgs { public: + using ArgsT = std::vector>; + CmdLineArgs() {} /** @@ -72,16 +69,17 @@ public: */ OsPath GetArg0() const; + /** + * Returns all arguments that don't have a name (string started with '-'). + */ + const ArgsT& GetArgs() const; + /** * Returns all arguments that don't have a name (string started with '-'). */ std::vector GetArgsWithoutName() const; private: - template - friend void Script::ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret, const T& val); - - typedef std::vector > ArgsT; ArgsT m_Args; OsPath m_Arg0; std::vector m_ArgsWithoutName;