Mercurial > hg > easyhg
comparison filestatuswidget.cpp @ 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 | f16fe0db11f3 |
children | c77c4d00a4fe |
comparison
equal
deleted
inserted
replaced
200:8c8c04bdf0fa | 201:0844b4d8d911 |
---|---|
144 void FileStatusWidget::openButtonClicked() | 144 void FileStatusWidget::openButtonClicked() |
145 { | 145 { |
146 QDir d(m_localPath); | 146 QDir d(m_localPath); |
147 if (d.exists()) { | 147 if (d.exists()) { |
148 QStringList args; | 148 QStringList args; |
149 args << d.canonicalPath(); | 149 QString path = d.canonicalPath(); |
150 #if defined Q_OS_WIN32 | |
151 // Although the Win32 API is quite happy to have | |
152 // forward slashes as directory separators, Windows | |
153 // Explorer is not | |
154 path = path.replace('/', '\\'); | |
155 args << path; | |
156 QProcess::execute("c:/windows/explorer.exe", args); | |
157 #else | |
158 args << path; | |
150 QProcess::execute( | 159 QProcess::execute( |
151 #if defined Q_OS_WIN32 | 160 #if defined Q_OS_MAC |
152 "c:/windows/explorer.exe", | |
153 #elif defined Q_OS_MAC | |
154 "/usr/bin/open", | 161 "/usr/bin/open", |
155 #else | 162 #else |
156 "/usr/bin/xdg-open", | 163 "/usr/bin/xdg-open", |
157 #endif | 164 #endif |
158 args); | 165 args); |
166 #endif | |
159 } | 167 } |
160 } | 168 } |
161 | 169 |
162 QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) | 170 QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) |
163 { | 171 { |