mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Fix open the explorer code.
This commit is contained in:
parent
58035a2f4a
commit
23f52bcd56
@ -247,7 +247,8 @@ void ProtocolWidget::slotOpenFile( QTreeWidgetItem *item, int )
|
|||||||
|
|
||||||
Folder *folder = FolderMan::instance()->folder(folderName);
|
Folder *folder = FolderMan::instance()->folder(folderName);
|
||||||
if (folder) {
|
if (folder) {
|
||||||
QString fullPath = folder->path() + '/' + fileName;
|
// folder->path() always comes back with trailing path
|
||||||
|
QString fullPath = folder->path() + fileName;
|
||||||
if (QFile(fullPath).exists()) {
|
if (QFile(fullPath).exists()) {
|
||||||
Utility::showInFileManager(fullPath);
|
Utility::showInFileManager(fullPath);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -314,13 +314,21 @@ static bool checkDolphinCanSelect()
|
|||||||
// inspired by Qt Creator's showInGraphicalShell();
|
// inspired by Qt Creator's showInGraphicalShell();
|
||||||
void Utility::showInFileManager(const QString &localPath)
|
void Utility::showInFileManager(const QString &localPath)
|
||||||
{
|
{
|
||||||
|
const QString sillyQuote("\"\"\"");
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
const QString explorer = "explorer.exe"; // FIXME: we trust it's in PATH
|
QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
|
||||||
QString param;
|
|
||||||
if (!QFileInfo(localPath).isDir())
|
if (!QFileInfo(localPath).isDir()) {
|
||||||
param += QLatin1String("/select,");
|
explorer += QLatin1String("/select,");
|
||||||
param += QDir::toNativeSeparators(localPath);
|
}
|
||||||
QProcess::startDetached(explorer, QStringList(param));
|
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()) {
|
} else if (isMac()) {
|
||||||
QStringList scriptArgs;
|
QStringList scriptArgs;
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user