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.
This commit is contained in:
Bevan Weiss 2020-08-26 18:07:29 +10:00 committed by Megamouse
parent 5669c7497d
commit c39ad1ee12
4 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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));

View File

@ -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);

View File

@ -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); });