Qt: Support custom user profile paths

Pretty much the most important option to support, even for a UI
frontend that's still a WIP. It's essential for testing.
This commit is contained in:
Léo Lam 2017-06-14 14:31:30 +02:00
parent 54e882941c
commit a9630727fe
1 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <OptionParser.h>
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QMessageBox>
@ -15,6 +16,7 @@
#include "DolphinQt2/MainWindow.h" #include "DolphinQt2/MainWindow.h"
#include "DolphinQt2/Resources.h" #include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h" #include "DolphinQt2/Settings.h"
#include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
int main(int argc, char* argv[]) int main(int argc, char* argv[])
@ -24,7 +26,11 @@ int main(int argc, char* argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
UICommon::SetUserDirectory(""); auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::IncludeGUIOptions);
const optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv);
const std::vector<std::string> args = parser->args();
UICommon::SetUserDirectory(static_cast<const char*>(options.get("user")));
UICommon::CreateDirectories(); UICommon::CreateDirectories();
UICommon::Init(); UICommon::Init();
Resources::Init(); Resources::Init();