[Pkg-owncloud-commits] [owncloud-client] 183/211: util: Use canonicalFilePath to clean the path opened by explorer.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:43 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit e726e7aad840628f9f432560146abeb6752ca0ba
Author: Klaas Freitag <freitag at owncloud.com>
Date: Thu Oct 23 10:40:22 2014 +0200
util: Use canonicalFilePath to clean the path opened by explorer.
This fixes bug #2299
---
src/mirall/openfilemanager.cpp | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/mirall/openfilemanager.cpp b/src/mirall/openfilemanager.cpp
index 397c5c5..698cc3d 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
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list