|
|
|
@ -572,8 +572,12 @@ void Utils::Misc::openPath(const QString &absolutePath)
@@ -572,8 +572,12 @@ void Utils::Misc::openPath(const QString &absolutePath)
|
|
|
|
|
void Utils::Misc::openFolderSelect(const QString &absolutePath) |
|
|
|
|
{ |
|
|
|
|
const QString path = Utils::Fs::fromNativePath(absolutePath); |
|
|
|
|
// If the item to select doesn't exist, try to open its parent
|
|
|
|
|
if (!QFileInfo(path).exists()) { |
|
|
|
|
openPath(path.left(path.lastIndexOf("/"))); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#ifdef Q_OS_WIN |
|
|
|
|
if (QFileInfo(path).exists()) { |
|
|
|
|
// Syntax is: explorer /select, "C:\Folder1\Folder2\file_to_select"
|
|
|
|
|
// Dir separators MUST be win-style slashes
|
|
|
|
|
|
|
|
|
@ -603,13 +607,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
@@ -603,13 +607,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
|
|
|
|
::CloseHandle(processInfo.hProcess); |
|
|
|
|
::CloseHandle(processInfo.hThread); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
// If the item to select doesn't exist, try to open its parent
|
|
|
|
|
openPath(path.left(path.lastIndexOf("/"))); |
|
|
|
|
} |
|
|
|
|
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC) |
|
|
|
|
if (QFileInfo(path).exists()) { |
|
|
|
|
QProcess proc; |
|
|
|
|
proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory"); |
|
|
|
|
proc.waitForFinished(); |
|
|
|
@ -626,11 +624,6 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
@@ -626,11 +624,6 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
|
|
|
|
|
else |
|
|
|
|
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
|
|
|
|
|
openPath(path.left(path.lastIndexOf("/"))); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
// If the item to select doesn't exist, try to open its parent
|
|
|
|
|
openPath(path.left(path.lastIndexOf("/"))); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
openPath(path.left(path.lastIndexOf("/"))); |
|
|
|
|
#endif |
|
|
|
|