From d8e7cd694d60625960172412b86e67791763d05a Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 27 Feb 2022 11:33:56 +1100 Subject: [PATCH] Small fix to `--config` parameter to allow for an argument + Added check to test for a valid directory --- cli.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cli.cpp b/cli.cpp index cea6469e..49d8ba52 100644 --- a/cli.cpp +++ b/cli.cpp @@ -5,6 +5,7 @@ #include #include "OpenRGB.h" #include "AutoStart.h" +#include "filesystem.h" #include "ProfileManager.h" #include "ResourceManager.h" #include "RGBController.h" @@ -1022,9 +1023,20 @@ unsigned int cli_pre_detection(int argc, char *argv[]) \*---------------------------------------------------------*/ else if(option == "--config") { - ResourceManager::get()->SetConfigurationDirectory(argument); - cfg_args++; + cfg_args+= 2; arg_index++; + + if(filesystem::is_directory(argument)) + { + ResourceManager::get()->SetConfigurationDirectory(argument); + LOG_INFO("Setting config directory to %s",argument.c_str()); + } + else + { + LOG_ERROR("'%s' is not a valid directory",argument.c_str()); + print_help = true; + break; + } } /*---------------------------------------------------------*\