#include "CommandLineArgs.h" #include "StringUtils.h" #ifdef _WIN32 #include "Windows.h" #endif CommandLineArgs::CommandLineArgs() : mArugments(), mLaunchPath() { } void CommandLineArgs::initialize(CommandLineArgs* args) { #ifdef _WIN32 int nArgs{ 0 }; auto szArglist = ::CommandLineToArgvW(::GetCommandLineW(), &nArgs); if (szArglist == nullptr) { return; } std::vector windowsArgs(nArgs); for (int idx = 0; idx < nArgs; idx++) { windowsArgs[idx] = StringUtils::convert(szArglist[idx]); } ::LocalFree(szArglist); args->process(windowsArgs); #endif } std::unique_ptr CommandLineArgs::Create() { return std::make_unique(); } std::filesystem::path CommandLineArgs::getLaunchPath() { return mLaunchPath; } void CommandLineArgs::recordLaunchPath() { mLaunchPath = std::filesystem::current_path(); } void CommandLineArgs::process(int argc, char *argv[]) { for(int idx=0; idx& args) { mArugments = args; } std::vector CommandLineArgs::getUserArgs() const { std::vector user_args; for(unsigned idx=1; idx CommandLineArgs::getArgs() const { return mArugments; }