mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 14:05:58 +03:00
util: Use canonicalFilePath to clean the path opened by explorer.
This fixes bug #2299
This commit is contained in:
parent
c7c05ea869
commit
e726e7aad8
1 changed files with 15 additions and 11 deletions
|
@ -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)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue