mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Use old method on Windows of opening a folder
This commit is contained in:
parent
cc4cda5aa0
commit
c743fd7377
@ -95,6 +95,21 @@ bool Util::writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObj
|
||||
void Util::openFolderInExplorer(const QString& url) const
|
||||
{
|
||||
const QString path = QUrl::fromUserInput(url).toLocalFile();
|
||||
|
||||
// QDesktopServices can hang on Windows
|
||||
if (QSysInfo::productType() == "windows") {
|
||||
QProcess explorer;
|
||||
explorer.setProgram("explorer.exe");
|
||||
// When we have space in the path like
|
||||
// C:\Program Files (x86)\Steam\...
|
||||
// we cannot set the path as an argument. But we can set the working it
|
||||
// to the wanted path and open the current path via the dot.
|
||||
explorer.setWorkingDirectory(QDir::toNativeSeparators(path));
|
||||
explorer.setArguments({ "." });
|
||||
explorer.startDetached();
|
||||
return;
|
||||
}
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user