aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-03-30 15:01:33 -0700
committerGitHub <noreply@github.com>2021-03-30 15:01:33 -0700
commit6e2bb2060f46cd863e0b6246aa8358afdcfd3e6f (patch)
tree8949fd213838a30e3494ebfc4195d4afa9cffb02 /src
parent4f41c6158f847b866d6bdee5174d2463d0fe4ee0 (diff)
parentb29c5da11d5cf2ae2300ef340646490bd09537e6 (diff)
Merge pull request #6116 from german77/userArgument
yuzu/main: Add user command line argument
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 24bfa4d349..06445b993d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -320,6 +320,34 @@ GMainWindow::GMainWindow()
continue;
}
+ // Launch game with a specific user
+ if (args[i] == QStringLiteral("-u")) {
+ if (i >= args.size() - 1) {
+ continue;
+ }
+
+ if (args[i + 1].startsWith(QChar::fromLatin1('-'))) {
+ continue;
+ }
+
+ bool argument_ok;
+ const std::size_t selected_user = args[++i].toUInt(&argument_ok);
+
+ if (!argument_ok) {
+ LOG_ERROR(Frontend, "Invalid user argument");
+ continue;
+ }
+
+ const Service::Account::ProfileManager manager;
+ if (!manager.UserExistsIndex(selected_user)) {
+ LOG_ERROR(Frontend, "Selected user doesn't exist");
+ continue;
+ }
+
+ Settings::values.current_user = selected_user;
+ continue;
+ }
+
// Launch game at path
if (args[i] == QStringLiteral("-g")) {
if (i >= args.size() - 1) {