From 43191e4005d6d5ef56b228d62f947e563160213a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 18 May 2022 18:32:13 +0200 Subject: [PATCH] Added a --create-systemdirs command line option to generate the game system directories. --- es-app/src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index a4b91581d..ed25e2b6c 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -62,6 +62,7 @@ namespace int lastTime {0}; bool forceInputConfig {false}; + bool createSystemDirectories {false}; bool settingsNeedSaving {false}; enum loadSystemsReturnCode { @@ -349,6 +350,9 @@ bool parseArgs(int argc, char* argv[]) else if (strcmp(argv[i], "--force-input-config") == 0) { forceInputConfig = true; } + else if (strcmp(argv[i], "--create-systemdirs") == 0) { + createSystemDirectories = true; + } else if (strcmp(argv[i], "--debug") == 0) { Settings::getInstance()->setBool("Debug", true); Log::setReportingLevel(LogDebug); @@ -377,6 +381,7 @@ bool parseArgs(int argc, char* argv[]) " --force-kiosk Force the UI mode to Kiosk\n" " --force-kid Force the UI mode to Kid\n" " --force-input-config Force configuration of input device\n" +" --create-systemdirs Create game system directories\n" " --home [path] Directory to use as home path\n" " --debug Print debug information\n" " --version, -v Display version information\n" @@ -543,6 +548,16 @@ int main(int argc, char* argv[]) // Always close the log on exit. atexit(&onExit); + if (createSystemDirectories) { + if (!SystemData::createSystemDirectories() && !Settings::getInstance()->getBool("Debug")) + std::cout << "System directories successfully created" << std::endl; + LOG(LogInfo) << "EmulationStation cleanly shutting down"; +#if defined(_WIN64) + FreeConsole(); +#endif + return 0; + } + #if defined(__EMSCRIPTEN__) // TODO: Remove when application window resizing has been implemented. Settings::getInstance()->setBool("Debug", true);