From c39ad1ee12cae40e107f1764266618b519819ed9 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Wed, 26 Aug 2020 18:07:29 +1000 Subject: [PATCH] Fix Windows UNC Path Handling In Windows, when using Open Install Folder etc with UNC paths, nothing would happen. This replaces the "file://"+path usage with QUrl::fromLocalFile(path) which appears to handle this better. Needs testing under non-Windows. --- rpcs3/rpcs3qt/qt_utils.cpp | 6 +++--- rpcs3/rpcs3qt/save_manager_dialog.cpp | 4 ++-- rpcs3/rpcs3qt/trophy_manager_dialog.cpp | 2 +- rpcs3/rpcs3qt/user_manager_dialog.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rpcs3/rpcs3qt/qt_utils.cpp b/rpcs3/rpcs3qt/qt_utils.cpp index 0d793483d5..99e167a1b7 100644 --- a/rpcs3/rpcs3qt/qt_utils.cpp +++ b/rpcs3/rpcs3qt/qt_utils.cpp @@ -300,13 +300,13 @@ namespace gui QProcess::execute("/usr/bin/osascript", { "-e", "tell application \"Finder\" to reveal POSIX file \"" + path + "\"" }); QProcess::execute("/usr/bin/osascript", { "-e", "tell application \"Finder\" to activate" }); #else - // open parent directory - QDesktopServices::openUrl(QUrl("file:///" + qstr(fs::get_parent_dir(spath)))); + // open parent directory + QDesktopServices::openUrl(QUrl::fromLocalFile(qstr(fs::get_parent_dir(spath)))); #endif return; } - QDesktopServices::openUrl(QUrl("file:///" + path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); } void open_dir(const QString& path) diff --git a/rpcs3/rpcs3qt/save_manager_dialog.cpp b/rpcs3/rpcs3qt/save_manager_dialog.cpp index a49d5157a8..6157ecf3c5 100644 --- a/rpcs3/rpcs3qt/save_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/save_manager_dialog.cpp @@ -203,7 +203,7 @@ void save_manager_dialog::Init(std::string dir) } const int idx_real = item->data(Qt::UserRole).toInt(); const QString path = qstr(m_dir + m_save_entries[idx_real].dirName + "/"); - QDesktopServices::openUrl(QUrl("file:///" + path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }); connect(slider_icon_size, &QAbstractSlider::valueChanged, this, &save_manager_dialog::SetIconSize); connect(m_list->horizontalHeader(), &QHeaderView::sectionClicked, this, &save_manager_dialog::OnSort); @@ -480,7 +480,7 @@ void save_manager_dialog::ShowContextMenu(const QPoint &pos) } const int idx_real = item->data(Qt::UserRole).toInt(); const QString path = qstr(m_dir + m_save_entries[idx_real].dirName + "/"); - QDesktopServices::openUrl(QUrl("file:///" + path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }); menu->exec(m_list->viewport()->mapToGlobal(pos)); diff --git a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp index d5b26bd535..7596095b46 100644 --- a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp @@ -668,7 +668,7 @@ void trophy_manager_dialog::ShowContextMenu(const QPoint& pos) connect(show_trophy_dir, &QAction::triggered, [=, this]() { QString path = qstr(m_trophies_db[db_ind]->path); - QDesktopServices::openUrl(QUrl("file:///" + path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }); menu->addAction(show_trophy_dir); diff --git a/rpcs3/rpcs3qt/user_manager_dialog.cpp b/rpcs3/rpcs3qt/user_manager_dialog.cpp index 74ce717790..b84999b3c2 100644 --- a/rpcs3/rpcs3qt/user_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/user_manager_dialog.cpp @@ -460,7 +460,7 @@ void user_manager_dialog::ShowContextMenu(const QPoint &pos) connect(show_dir_act, &QAction::triggered, [=, this]() { QString path = qstr(m_user_list[key].GetUserDir()); - QDesktopServices::openUrl(QUrl("file:///" + path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }); connect(user_id_act, &QAction::triggered, this, [=, this] {OnSort(0); });