2020-05-02 07:31:03 +00:00
|
|
|
#include "CommandLineArgs.h"
|
|
|
|
|
|
|
|
CommandLineArgs::CommandLineArgs()
|
2020-05-09 14:29:45 +00:00
|
|
|
: mArugments(),
|
|
|
|
mLaunchPath()
|
2020-05-02 07:31:03 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-05-09 14:29:45 +00:00
|
|
|
std::unique_ptr<CommandLineArgs> CommandLineArgs::CreateUnique()
|
|
|
|
{
|
|
|
|
return std::make_unique<CommandLineArgs>();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::filesystem::path CommandLineArgs::GetLaunchPath()
|
|
|
|
{
|
|
|
|
return mLaunchPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CommandLineArgs::RecordLaunchPath()
|
|
|
|
{
|
|
|
|
mLaunchPath = std::filesystem::current_path();
|
|
|
|
}
|
|
|
|
|
2020-05-02 07:31:03 +00:00
|
|
|
void CommandLineArgs::Process(int argc, char *argv[])
|
|
|
|
{
|
2020-05-09 14:29:45 +00:00
|
|
|
for(int idx=0; idx<argc; idx++)
|
|
|
|
{
|
|
|
|
mArugments.push_back(std::string(argv[idx]));
|
|
|
|
}
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 13:04:48 +00:00
|
|
|
void CommandLineArgs::Process(const std::vector<std::string>& args)
|
|
|
|
{
|
|
|
|
mArugments = args;
|
|
|
|
}
|
|
|
|
|
2020-05-02 07:31:03 +00:00
|
|
|
std::size_t CommandLineArgs::GetNumberOfArgs() const
|
|
|
|
{
|
2020-05-09 14:29:45 +00:00
|
|
|
return mArugments.size();
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string CommandLineArgs::GetArg(std::size_t index) const
|
|
|
|
{
|
2020-05-09 14:29:45 +00:00
|
|
|
if(index<mArugments.size())
|
|
|
|
{
|
|
|
|
return mArugments[index];
|
|
|
|
}
|
|
|
|
return "";
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|