mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Qt: Fix open_dir for paths with multiple slashes
This commit is contained in:
parent
e3cd31f057
commit
f894e2b9a2
@ -397,17 +397,18 @@ namespace gui
|
|||||||
|
|
||||||
void open_dir(const std::string& spath)
|
void open_dir(const std::string& spath)
|
||||||
{
|
{
|
||||||
const QString path = qstr(spath);
|
QString path = qstr(spath);
|
||||||
|
|
||||||
if (fs::is_file(spath))
|
if (fs::is_file(spath))
|
||||||
{
|
{
|
||||||
// open directory and select file
|
// open directory and select file
|
||||||
// https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
|
// https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const QString cleaned_path = QDir::toNativeSeparators(path);
|
// Remove double slashes and convert to native separators. Double slashes don't seem to work with the explorer call.
|
||||||
gui_log.notice("gui::utils::open_dir: About to open file path '%s' (original: '%s')", cleaned_path.toStdString(), spath);
|
path.replace(QRegularExpression("[\\\\|/]+"), QDir::separator());
|
||||||
|
gui_log.notice("gui::utils::open_dir: About to open file path '%s' (original: '%s')", path.toStdString(), spath);
|
||||||
|
|
||||||
if (!QProcess::startDetached("explorer.exe", {"/select,", cleaned_path}))
|
if (!QProcess::startDetached("explorer.exe", {"/select,", path}))
|
||||||
{
|
{
|
||||||
gui_log.error("gui::utils::open_dir: Failed to start explorer process");
|
gui_log.error("gui::utils::open_dir: Failed to start explorer process");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user