forked from osmocom/wireshark
Qt: Fix show in folder issue
Opening a folder on Windows lead to undesired behaviour Fixes: #17927
This commit is contained in:
parent
bb8e3db0c6
commit
5b6bf0b4f3
|
@ -196,11 +196,7 @@ void desktop_show_in_folder(const QString file_path)
|
|||
{
|
||||
bool success = false;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QString path = QDir::toNativeSeparators(file_path);
|
||||
QStringList explorer_args = QStringList() << "/select," + path;
|
||||
success = QProcess::startDetached("explorer.exe", explorer_args);
|
||||
#elif defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_MAC)
|
||||
QStringList script_args;
|
||||
QString escaped_path = file_path;
|
||||
|
||||
|
@ -218,7 +214,7 @@ void desktop_show_in_folder(const QString file_path)
|
|||
#else
|
||||
// Is there a way to highlight the file using xdg-open?
|
||||
#endif
|
||||
if (!success) { // Last resort
|
||||
if (!success) {
|
||||
QFileInfo file_info(file_path);
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(file_info.dir().absolutePath()));
|
||||
}
|
||||
|
|
|
@ -390,6 +390,8 @@ void WelcomePage::showRecentFolder()
|
|||
if (!ria) return;
|
||||
|
||||
QString cf_path = ria->data().toString();
|
||||
if (cf_path.isEmpty()) return;
|
||||
|
||||
desktop_show_in_folder(cf_path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue