aboutsummaryrefslogtreecommitdiff
path: root/launcher/Commandline.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
commitc94ee67077076fdfb3ad04e93a0de2ae32b6a4e5 (patch)
tree437dec3be224cae5e229eeaa4ac9ebeedffd03e3 /launcher/Commandline.cpp
parent019e5ca3e819f5daf9933bc0fb091784b0ca561f (diff)
parent8f5bb982cd27dd9158b63d826769c168455a139b (diff)
downloadPrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.gz
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.bz2
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curseforge-url-handle3
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/Commandline.cpp')
-rw-r--r--launcher/Commandline.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/launcher/Commandline.cpp b/launcher/Commandline.cpp
index 6d97918d..8489fb74 100644
--- a/launcher/Commandline.cpp
+++ b/launcher/Commandline.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -41,8 +41,7 @@
* @file libutil/src/cmdutils.cpp
*/
-namespace Commandline
-{
+namespace Commandline {
// commandline splitter
QStringList splitArgs(QString args)
@@ -51,19 +50,15 @@ QStringList splitArgs(QString args)
QString current;
bool escape = false;
QChar inquotes;
- for (int i = 0; i < args.length(); i++)
- {
+ for (int i = 0; i < args.length(); i++) {
QChar cchar = args.at(i);
// \ escaped
- if (escape)
- {
+ if (escape) {
current += cchar;
escape = false;
// in "quotes"
- }
- else if (!inquotes.isNull())
- {
+ } else if (!inquotes.isNull()) {
if (cchar == '\\')
escape = true;
else if (cchar == inquotes)
@@ -71,18 +66,13 @@ QStringList splitArgs(QString args)
else
current += cchar;
// otherwise
- }
- else
- {
- if (cchar == ' ')
- {
- if (!current.isEmpty())
- {
+ } else {
+ if (cchar == ' ') {
+ if (!current.isEmpty()) {
argv << current;
current.clear();
}
- }
- else if (cchar == '"' || cchar == '\'')
+ } else if (cchar == '"' || cchar == '\'')
inquotes = cchar;
else
current += cchar;
@@ -92,4 +82,4 @@ QStringList splitArgs(QString args)
argv << current;
return argv;
}
-}
+} // namespace Commandline