diff --git a/src/Unlinker/UnlinkerArgs.cpp b/src/Unlinker/UnlinkerArgs.cpp index 61682225..598e3701 100644 --- a/src/Unlinker/UnlinkerArgs.cpp +++ b/src/Unlinker/UnlinkerArgs.cpp @@ -40,7 +40,7 @@ const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() .WithShortName("o") .WithLongName("output-folder") - .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to ./%zoneName%") + .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") .WithParameter("outputFolderPath") .Build(); @@ -77,19 +77,20 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[] }; UnlinkerArgs::UnlinkerArgs() - : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent::value) + : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent::value), + m_zone_pattern(R"(\?zone\?)"), + m_task(ProcessingTask::DUMP), + m_minimal_zone_def(false), + m_use_gdt(false), + m_verbose(false) { - m_task = ProcessingTask::DUMP; - m_output_folder = "./%zoneName%"; - - m_verbose = false; } void UnlinkerArgs::PrintUsage() { - UsageInformation usage("unlinker.exe"); + UsageInformation usage("Unlinker.exe"); - for (auto commandLineOption : COMMAND_LINE_OPTIONS) + for (const auto* commandLineOption : COMMAND_LINE_OPTIONS) { usage.AddCommandLineOption(commandLineOption); } @@ -109,9 +110,9 @@ void UnlinkerArgs::SetVerbose(const bool isVerbose) bool UnlinkerArgs::SetImageDumpingMode() { - std::string specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT); + auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT); for (auto& c : specifiedValue) - c = tolower(c); + c = static_cast(tolower(c)); if (specifiedValue == "dds") { @@ -168,6 +169,8 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv) // -o; --output-folder if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER)) m_output_folder = m_argument_parser.GetValueForOption(OPTION_OUTPUT_FOLDER); + else + m_output_folder = DEFAULT_OUTPUT_FOLDER; // --search-path if (m_argument_parser.IsOptionSpecified(OPTION_SEARCH_PATH)) @@ -195,5 +198,5 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv) std::string UnlinkerArgs::GetOutputFolderPathForZone(Zone* zone) const { - return std::regex_replace(m_output_folder, std::regex("%zoneName%"), zone->m_name); + return std::regex_replace(m_output_folder, m_zone_pattern, zone->m_name); } diff --git a/src/Unlinker/UnlinkerArgs.h b/src/Unlinker/UnlinkerArgs.h index 5a454932..c07be05b 100644 --- a/src/Unlinker/UnlinkerArgs.h +++ b/src/Unlinker/UnlinkerArgs.h @@ -1,13 +1,19 @@ #pragma once +#include +#include +#include + #include "Utils/Arguments/ArgumentParser.h" #include "Zone/Zone.h" -#include -#include - class UnlinkerArgs { +public: + static constexpr const char* DEFAULT_OUTPUT_FOLDER = "zone_dump/zone_raw/?zone?"; + +private: ArgumentParser m_argument_parser; + std::regex m_zone_pattern; /** * \brief Prints a command line usage help text for the Unlinker tool to stdout.