diff options
author | Klaas Freitag <freitag@owncloud.com> | 2014-10-23 12:40:22 +0400 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2014-10-23 12:41:07 +0400 |
commit | e726e7aad840628f9f432560146abeb6752ca0ba (patch) | |
tree | b61f713b26d6bc46ddd8bafa8a511e1adf8b84ca | |
parent | c7c05ea869b6b70d502f1552cbbbe84ce1d1d7ae (diff) |
util: Use canonicalFilePath to clean the path opened by explorer.
This fixes bug #2299
-rw-r--r-- | src/mirall/openfilemanager.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mirall/openfilemanager.cpp b/src/mirall/openfilemanager.cpp index 397c5c56a..698cc3dd9 100644 --- a/src/mirall/openfilemanager.cpp +++ b/src/mirall/openfilemanager.cpp @@ -90,18 +90,22 @@ void showInFileManager(const QString &localPath) } #endif QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH + QFileInfo fi(localPath); - if (!QFileInfo(localPath).isDir()) { - explorer += QLatin1String("/select,"); + // canonicalFilePath returns empty if the file does not exist + 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()) { QStringList scriptArgs; scriptArgs << QLatin1String("-e") @@ -182,4 +186,4 @@ void showInFileManager(const QString &localPath) } } -}
\ No newline at end of file +} |