Use QDir::toNativeSeparators instead of QString::replace. Add QProcess include for windows build.

This commit is contained in:
Andreas 2013-06-09 16:29:40 +02:00
parent d16ac382ef
commit a6a8997a2e
1 changed files with 3 additions and 3 deletions

View File

@ -46,6 +46,7 @@
# include <sys/statvfs.h>
#elif defined(Q_OS_WIN32)
# include <windows.h>
# include <QProcess>
#endif
#ifdef Q_OS_LINUX
@ -352,10 +353,8 @@ void RevealFileInFinder(QString const& path) {
#ifdef Q_OS_WIN
void ShowFileInExplorer(QString const& path) {
// QUrl.toLocalFile() returns the path always with forward slashes,
// but the explorer needs two backslashes to navigate to the file.
QProcess::execute("explorer.exe", QStringList() << "/select,"
<< path.replace("/", "\\"));
<< QDir::toNativeSeparators(path);
}
#endif
@ -375,6 +374,7 @@ void OpenInFileBrowser(const QList<QUrl>& urls) {
if (dirs.contains(directory))
continue;
dirs.insert(directory);
qLog(Debug) << path;
#ifdef Q_OS_DARWIN
// revealing multiple files in the finder only opens one window,
// so it also makes sense to reveal at most one per directory