Merge pull request #5033 from vladfi1/nogui-user

Parse user directory on nogui CLI.
This commit is contained in:
Markus Wick 2017-03-08 10:04:12 +01:00 committed by GitHub
commit 7cc5604a2c
1 changed files with 8 additions and 2 deletions

View File

@ -380,11 +380,11 @@ static Platform* GetPlatform()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
std::string boot_filename;
auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::OmitGUIOptions); auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::OmitGUIOptions);
optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv); optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv);
std::vector<std::string> args = parser->args(); std::vector<std::string> args = parser->args();
std::string boot_filename;
if (options.is_set("exec")) if (options.is_set("exec"))
{ {
boot_filename = static_cast<const char*>(options.get("exec")); boot_filename = static_cast<const char*>(options.get("exec"));
@ -400,6 +400,12 @@ int main(int argc, char* argv[])
return 0; return 0;
} }
std::string user_directory;
if (options.is_set("user"))
{
user_directory = static_cast<const char*>(options.get("user"));
}
platform = GetPlatform(); platform = GetPlatform();
if (!platform) if (!platform)
{ {
@ -407,7 +413,7 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
UICommon::SetUserDirectory(""); // Auto-detect user folder UICommon::SetUserDirectory(user_directory);
UICommon::Init(); UICommon::Init();
Core::SetOnStoppedCallback([]() { s_running.Clear(); }); Core::SetOnStoppedCallback([]() { s_running.Clear(); });