mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
util: Use canonicalFilePath to clean the path opened by explorer.
This fixes bug #2299
This commit is contained in:
parent
c7c05ea869
commit
e726e7aad8
1 changed files with 15 additions and 11 deletions
|
@ -90,18 +90,22 @@ void showInFileManager(const QString &localPath)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
|
QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
|
||||||
|
QFileInfo fi(localPath);
|
||||||
|
|
||||||
if (!QFileInfo(localPath).isDir()) {
|
// canonicalFilePath returns empty if the file does not exist
|
||||||
explorer += QLatin1String("/select,");
|
if( !fi.canonicalFilePath().isEmpty() ) {
|
||||||
|
if (!fi.isDir()) {
|
||||||
|
explorer += QLatin1String("/select,");
|
||||||
|
}
|
||||||
|
explorer += QLatin1Char('"');
|
||||||
|
explorer += QDir::toNativeSeparators(fi.canonicalFilePath());
|
||||||
|
explorer += QLatin1Char('"');
|
||||||
|
|
||||||
|
qDebug() << "OO Open explorer commandline:" << explorer;
|
||||||
|
QProcess p;
|
||||||
|
p.start(explorer);
|
||||||
|
p.waitForFinished(5000);
|
||||||
}
|
}
|
||||||
explorer += QLatin1Char('"');
|
|
||||||
explorer += QDir::toNativeSeparators(localPath);
|
|
||||||
explorer += QLatin1Char('"');
|
|
||||||
|
|
||||||
qDebug() << "OO Open explorer commandline:" << explorer;
|
|
||||||
QProcess p;
|
|
||||||
p.start(explorer);
|
|
||||||
p.waitForFinished(5000);
|
|
||||||
} else if (Utility::isMac()) {
|
} else if (Utility::isMac()) {
|
||||||
QStringList scriptArgs;
|
QStringList scriptArgs;
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
|
@ -182,4 +186,4 @@ void showInFileManager(const QString &localPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue