Skip to content

Commit

Permalink
Qt: fix opening folders by using util functions part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Dec 10, 2022
1 parent b213a26 commit 9fb1351
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rpcs3/rpcs3qt/qt_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,10 @@ namespace gui
#else
// open parent directory
const QUrl url = QUrl::fromLocalFile(qstr(fs::get_parent_dir(spath)));
const std::string url_path = url.toString().toStdString();
gui_log.notice("gui::utils::open_dir: About to open parent dir url '%s' for path '%s'", url_path, spath);
const QString url_path = url.toString();
gui_log.notice("gui::utils::open_dir: About to open parent dir url '%s' for path '%s'", url_path.toStdString(), spath);

if (!QDesktopServices::openUrl(url))
{
gui_log.error("gui::utils::open_dir: Failed to open parent dir url '%s' for path '%s'", url_path, spath);
}
QProcess::execute("xdg-open", { url_path });
#endif
return;
}
Expand All @@ -437,13 +434,17 @@ namespace gui
}

const QUrl url = QUrl::fromLocalFile(path);
const std::string url_path = url.toString().toStdString();
gui_log.notice("gui::utils::open_dir: About to open dir url '%s' for path '%s'", url_path, spath);
const QString url_path = url.toString();
gui_log.notice("gui::utils::open_dir: About to open dir url '%s' for path '%s'", url_path.toStdString(), spath);

#ifdef __linux__
QProcess::execute("xdg-open", {url_path});
#else
if (!QDesktopServices::openUrl(url))
{
gui_log.error("gui::utils::open_dir: Failed to open dir url '%s' for path '%s'", url_path, spath);
gui_log.error("gui::utils::open_dir: Failed to open dir url '%s' for path '%s'", url_path.toStdString(), spath);
}
#endif
}

void open_dir(const QString& path)
Expand Down

0 comments on commit 9fb1351

Please sign in to comment.