[Base] Fix path parsing from commandline.

This commit is contained in:
gibbed 2020-04-08 12:29:02 -05:00 committed by Rick Gibbed
parent 637a8464a7
commit b37579fad2
1 changed files with 17 additions and 0 deletions

View File

@ -104,16 +104,33 @@ template <class T>
void CommandVar<T>::AddToLaunchOptions(cxxopts::Options* options) { void CommandVar<T>::AddToLaunchOptions(cxxopts::Options* options) {
options->add_options()(name_, description_, cxxopts::value<T>()); options->add_options()(name_, description_, cxxopts::value<T>());
} }
template <>
inline void CommandVar<std::filesystem::path>::AddToLaunchOptions(
cxxopts::Options* options) {
options->add_options()(name_, description_, cxxopts::value<std::string>());
}
template <class T> template <class T>
void ConfigVar<T>::AddToLaunchOptions(cxxopts::Options* options) { void ConfigVar<T>::AddToLaunchOptions(cxxopts::Options* options) {
options->add_options(category_)(this->name_, this->description_, options->add_options(category_)(this->name_, this->description_,
cxxopts::value<T>()); cxxopts::value<T>());
} }
template <>
inline void ConfigVar<std::filesystem::path>::AddToLaunchOptions(
cxxopts::Options* options) {
options->add_options(category_)(this->name_, this->description_,
cxxopts::value<std::string>());
}
template <class T> template <class T>
void CommandVar<T>::LoadFromLaunchOptions(cxxopts::ParseResult* result) { void CommandVar<T>::LoadFromLaunchOptions(cxxopts::ParseResult* result) {
T value = (*result)[name_].template as<T>(); T value = (*result)[name_].template as<T>();
SetCommandLineValue(value); SetCommandLineValue(value);
} }
template <>
inline void CommandVar<std::filesystem::path>::LoadFromLaunchOptions(
cxxopts::ParseResult* result) {
std::string value = (*result)[name_].template as<std::string>();
SetCommandLineValue(value);
}
template <class T> template <class T>
void ConfigVar<T>::LoadConfigValue(std::shared_ptr<cpptoml::base> result) { void ConfigVar<T>::LoadConfigValue(std::shared_ptr<cpptoml::base> result) {
SetConfigValue(*cpptoml::get_impl<T>(result)); SetConfigValue(*cpptoml::get_impl<T>(result));