aboutsummaryrefslogtreecommitdiff
path: root/application/MultiMC.cpp
diff options
context:
space:
mode:
authorOverMighty <its.overmighty@gmail.com>2020-05-04 11:37:02 +0200
committerOverMighty <its.overmighty@gmail.com>2020-05-04 11:37:02 +0200
commitbbcacec6eca70fefcb6c7a3249586a8c7b2fb634 (patch)
tree25fb0f643392127ee1eac2259e8943c7fde92808 /application/MultiMC.cpp
parent313a6574c15e0cc0fd9bb510609b63905d1c760b (diff)
downloadPrismLauncher-bbcacec6eca70fefcb6c7a3249586a8c7b2fb634.tar.gz
PrismLauncher-bbcacec6eca70fefcb6c7a3249586a8c7b2fb634.tar.bz2
PrismLauncher-bbcacec6eca70fefcb6c7a3249586a8c7b2fb634.zip
fix: add support for args with spaces to MultiMC::messageReceived()
Previously, when the main instance of MultiMC would receive an `import` or `launch` message from another instance, it would split the message on each space, and only read the first word of the argument (zip path/URL or instance ID). This commit fixes that problem by sectioning the message string instead.
Diffstat (limited to 'application/MultiMC.cpp')
-rw-r--r--application/MultiMC.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 393ea046..86f426f8 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -867,8 +867,7 @@ void MultiMC::messageReceived(const QString& message)
return;
}
- QStringList args = message.split(' ');
- QString command = args.takeFirst();
+ QString command = message.section(' ', 0, 0);
if(command == "activate")
{
@@ -876,21 +875,23 @@ void MultiMC::messageReceived(const QString& message)
}
else if(command == "import")
{
- if(args.isEmpty())
+ QString arg = message.section(' ', 1);
+ if(arg.isEmpty())
{
qWarning() << "Received" << command << "message without a zip path/URL.";
return;
}
- m_mainWindow->droppedURLs({ QUrl(args.takeFirst()) });
+ m_mainWindow->droppedURLs({ QUrl(arg) });
}
else if(command == "launch")
{
- if(args.isEmpty())
+ QString arg = message.section(' ', 1);
+ if(arg.isEmpty())
{
qWarning() << "Received" << command << "message without an instance ID.";
return;
}
- auto inst = instances()->getInstanceById(args.takeFirst());
+ auto inst = instances()->getInstanceById(arg);
if(inst)
{
launch(inst, true, nullptr);