mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[Base] Fix invalid cvar args causing silent exit.
[Base] Fix invalid cvar arguments causing Xenia to silently exit.
This commit is contained in:
parent
a77ed6f4a7
commit
bf5f700f9e
|
|
@ -14,6 +14,9 @@
|
||||||
#define UTF_CPP_CPLUSPLUS 201703L
|
#define UTF_CPP_CPLUSPLUS 201703L
|
||||||
#include "third_party/utfcpp/source/utf8.h"
|
#include "third_party/utfcpp/source/utf8.h"
|
||||||
|
|
||||||
|
#include "xenia/base/logging.h"
|
||||||
|
#include "xenia/base/main.h"
|
||||||
|
|
||||||
namespace utfcpp = utf8;
|
namespace utfcpp = utf8;
|
||||||
|
|
||||||
using u8_citer = utfcpp::iterator<std::string_view::const_iterator>;
|
using u8_citer = utfcpp::iterator<std::string_view::const_iterator>;
|
||||||
|
|
@ -61,7 +64,12 @@ void ParseLaunchArguments(int& argc, char**& argv,
|
||||||
|
|
||||||
auto result = options.parse(argc, argv);
|
auto result = options.parse(argc, argv);
|
||||||
if (result.count("help")) {
|
if (result.count("help")) {
|
||||||
|
if (xe::has_console_attached()) {
|
||||||
PrintHelpAndExit();
|
PrintHelpAndExit();
|
||||||
|
} else {
|
||||||
|
xe::ShowInfoMessageBox(options.help({""}));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& it : *CmdVars) {
|
for (auto& it : *CmdVars) {
|
||||||
|
|
@ -78,8 +86,15 @@ void ParseLaunchArguments(int& argc, char**& argv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (const cxxopts::OptionException& e) {
|
} catch (const cxxopts::OptionException& e) {
|
||||||
|
if (xe::has_console_attached()) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
PrintHelpAndExit();
|
PrintHelpAndExit();
|
||||||
|
} else {
|
||||||
|
std::string m =
|
||||||
|
"Invalid launch options were given.\n" + options.help({""});
|
||||||
|
xe::ShowErrorMessageBox(m);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue