From a4870d4834f627f6c730d7b72237d7357aeacc8f Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Mon, 2 Jan 2023 08:55:32 -0700 Subject: [PATCH] fix: fix #700 fixed by properly converting from a file path and converting to native seperators. should have known naive handling of file path as a URL would come back to bite us cross platform. Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/Application.cpp | 6 +++--- launcher/ui/MainWindow.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 581e51aed..19d6d3c29 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -263,11 +263,11 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_instanceIdToShowWindowOf = parser.value("show"); for (auto zip_path : parser.values("import")){ - m_zipsToImport.append(QUrl(zip_path)); + m_zipsToImport.append(QUrl::fromLocalFile(QFileInfo(zip_path).absoluteFilePath())); } for (auto zip_path : parser.positionalArguments()){ // treat unspesified positional arguments as import urls - m_zipsToImport.append(QUrl(zip_path)); + m_zipsToImport.append(QUrl::fromLocalFile(QFileInfo(zip_path).absoluteFilePath())); } @@ -1065,7 +1065,7 @@ void Application::messageReceived(const QByteArray& message) qWarning() << "Received" << command << "message without a zip path/URL."; return; } - m_mainWindow->processURLs({ QUrl(path) }); + m_mainWindow->processURLs({ QUrl::fromLocalFile(QFileInfo(path).absoluteFilePath()) }); } else if(command == "launch") { diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 6412728a2..d5aa4c1a0 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1827,7 +1827,7 @@ void MainWindow::processURLs(QList urls) break; } - auto localFileName = url.toLocalFile(); + auto localFileName = QDir::toNativeSeparators(url.toLocalFile()) ; QFileInfo localFileInfo(localFileName); auto type = ResourceUtils::identify(localFileInfo);