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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user