Fix open the explorer code.

This commit is contained in:
Klaas Freitag 2013-12-17 10:16:25 +01:00
parent 58035a2f4a
commit 23f52bcd56
2 changed files with 16 additions and 7 deletions

View File

@ -247,7 +247,8 @@ void ProtocolWidget::slotOpenFile( QTreeWidgetItem *item, int )
Folder *folder = FolderMan::instance()->folder(folderName);
if (folder) {
QString fullPath = folder->path() + '/' + fileName;
// folder->path() always comes back with trailing path
QString fullPath = folder->path() + fileName;
if (QFile(fullPath).exists()) {
Utility::showInFileManager(fullPath);
}

View File

@ -314,13 +314,21 @@ static bool checkDolphinCanSelect()
// inspired by Qt Creator's showInGraphicalShell();
void Utility::showInFileManager(const QString &localPath)
{
const QString sillyQuote("\"\"\"");
if (isWindows()) {
const QString explorer = "explorer.exe"; // FIXME: we trust it's in PATH
QString param;
if (!QFileInfo(localPath).isDir())
param += QLatin1String("/select,");
param += QDir::toNativeSeparators(localPath);
QProcess::startDetached(explorer, QStringList(param));
QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
if (!QFileInfo(localPath).isDir()) {
explorer += QLatin1String("/select,");
}
explorer += sillyQuote;
explorer += QDir::toNativeSeparators(localPath);
explorer += sillyQuote;
qDebug() << "OO Open explorer commandline:" << explorer;
QProcess p;
p.start(explorer);
p.waitForFinished(5000);
} else if (isMac()) {
QStringList scriptArgs;
scriptArgs << QLatin1String("-e")