From e4ec0fa46b927fb6b79e00cab8a92006a3fc3946 Mon Sep 17 00:00:00 2001 From: jath03 Date: Thu, 7 Jan 2021 22:39:29 -0800 Subject: [PATCH] Fixed GUI not starting when configuration flags are used --- cli.cpp | 11 ++++++++++- main.cpp | 6 +----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cli.cpp b/cli.cpp index 4b077c3b..7ef140f5 100644 --- a/cli.cpp +++ b/cli.cpp @@ -936,6 +936,7 @@ unsigned int cli_pre_detection(int argc, char *argv[]) | to detecting devices and/or starting clients | \*---------------------------------------------------------*/ int arg_index = 1; + unsigned int cfg_args = 0; unsigned int ret_flags = 0; unsigned short server_port = OPENRGB_SDK_PORT; bool server_start = false; @@ -960,6 +961,7 @@ unsigned int cli_pre_detection(int argc, char *argv[]) if(option == "--localconfig") { ResourceManager::get()->SetConfigurationDirectory("./"); + cfg_args++; } /*---------------------------------------------------------*\ @@ -968,6 +970,7 @@ unsigned int cli_pre_detection(int argc, char *argv[]) else if(option == "--config") { ResourceManager::get()->SetConfigurationDirectory(argument); + cfg_args++; arg_index++; } @@ -977,6 +980,7 @@ unsigned int cli_pre_detection(int argc, char *argv[]) else if(option == "--nodetect") { ret_flags |= RET_FLAG_NO_DETECT; + cfg_args++; } /*---------------------------------------------------------*\ @@ -1066,7 +1070,7 @@ unsigned int cli_pre_detection(int argc, char *argv[]) print_help = true; break; } - + cfg_args++; arg_index++; } @@ -1135,6 +1139,11 @@ unsigned int cli_pre_detection(int argc, char *argv[]) ret_flags |= RET_FLAG_START_SERVER; } + if((argc - cfg_args) <= 1) + { + ret_flags |= RET_FLAG_START_GUI; + } + return(ret_flags); } diff --git a/main.cpp b/main.cpp index 9404d1f2..5fda4825 100644 --- a/main.cpp +++ b/main.cpp @@ -167,11 +167,7 @@ int main(int argc, char* argv[]) /*---------------------------------------------------------*\ | Process command line arguments before detection | \*---------------------------------------------------------*/ - unsigned int ret_flags = RET_FLAG_START_GUI; - if (argc > 1) - { - ret_flags = cli_pre_detection(argc, argv); - } + unsigned int ret_flags = cli_pre_detection(argc, argv); /*---------------------------------------------------------*\ | Perform local connection and/or hardware detection if not |