mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Windows: Fix opening activity entries with a space in the name
This fixes #2601
This commit is contained in:
parent
70c8803a79
commit
0d2b7967bc
1 changed files with 12 additions and 5 deletions
|
@ -94,15 +94,22 @@ void showInFileManager(const QString &localPath)
|
|||
|
||||
// canonicalFilePath returns empty if the file does not exist
|
||||
if( !fi.canonicalFilePath().isEmpty() ) {
|
||||
QString nativeArgs;
|
||||
if (!fi.isDir()) {
|
||||
explorer += QLatin1String("/select,");
|
||||
nativeArgs += QLatin1String("/select,");
|
||||
}
|
||||
explorer += QLatin1Char('"');
|
||||
explorer += QDir::toNativeSeparators(fi.canonicalFilePath());
|
||||
explorer += QLatin1Char('"');
|
||||
nativeArgs += QLatin1Char('"');
|
||||
nativeArgs += QDir::toNativeSeparators(fi.canonicalFilePath());
|
||||
nativeArgs += QLatin1Char('"');
|
||||
|
||||
qDebug() << "OO Open explorer commandline:" << explorer;
|
||||
qDebug() << "OO Open explorer commandline:" << explorer << nativeArgs;
|
||||
QProcess p;
|
||||
#ifdef Q_OS_WIN
|
||||
// QProcess on Windows tries to wrap the whole argument/program string
|
||||
// with quotes if it detects a space in it, but explorer wants the quotes
|
||||
// only around the path. Use setNativeArguments to bypass this logic.
|
||||
p.setNativeArguments(nativeArgs);
|
||||
#endif
|
||||
p.start(explorer);
|
||||
p.waitForFinished(5000);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue