changeset 201:0844b4d8d911

* Ensure explorer.exe invocation gets backslashes as directory separators, not forward slashes
author Chris Cannam
date Tue, 04 Jan 2011 14:05:17 +0000
parents 8c8c04bdf0fa
children c77c4d00a4fe
files filestatuswidget.cpp
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/filestatuswidget.cpp	Tue Jan 04 12:42:28 2011 +0000
+++ b/filestatuswidget.cpp	Tue Jan 04 14:05:17 2011 +0000
@@ -146,16 +146,24 @@
     QDir d(m_localPath);
     if (d.exists()) {
         QStringList args;
-        args << d.canonicalPath();
+        QString path = d.canonicalPath();
+#if defined Q_OS_WIN32
+        // Although the Win32 API is quite happy to have
+        // forward slashes as directory separators, Windows
+        // Explorer is not
+        path = path.replace('/', '\\');
+        args << path;
+        QProcess::execute("c:/windows/explorer.exe", args);
+#else
+        args << path;
         QProcess::execute(
-#if defined Q_OS_WIN32
-            "c:/windows/explorer.exe",
-#elif defined Q_OS_MAC
+#if defined Q_OS_MAC
             "/usr/bin/open",
 #else
             "/usr/bin/xdg-open",
 #endif
             args);
+#endif
     }
 }