aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/firewall_rules_dialog.cpp
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2023-11-10 00:08:48 -0800
committerGuy Harris <gharris@sonic.net>2023-11-12 06:53:36 +0000
commit19f7e572a454309b99b87f3753e42551a7f208f7 (patch)
tree4bcb177a156e5809b1cc4d15d904609ac64d49d8 /ui/qt/firewall_rules_dialog.cpp
parent12b015d1c4c872ece75901f48f1b0e55b75acf92 (diff)
Work around macOS running applications in /.
If an application is launched from the Finder, it appears to get / as its current directory. This causes Wireshark open/save dialogs to open up / if the user hasn't already opened a file in another directory, so that there's no "last open directory" in the recent file. Have get_persdatafile_dir(), on UN*X, cache the personal data directory just as it does on Windows and, if nothing's been cached, have it fetch the current directory and, if that succeeds *and* it's not the root directory, use that. Otherwise, use the user's home directory. Fixes #9862. In addition, separate the notion of "last open directory" and "open dialog initial directory", where the latter is the last open directory *if* a file has been opened in this session or the recent file has the last open directory from a previous session, otherwise it's the user's personal data directory. Use the latter notion in file open/save dialogs; use the former notion when reading from and writing to the recent file. This means we don't need to set the "last open directory" at startup time. That way, running Wireshark without opening a file won't cause the "last open directory" to be set, so that if a user runs it from a directory, the "open dialog initial directory" won't be the last directory from which Wireshark was run.
Diffstat (limited to 'ui/qt/firewall_rules_dialog.cpp')
-rw-r--r--ui/qt/firewall_rules_dialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/qt/firewall_rules_dialog.cpp b/ui/qt/firewall_rules_dialog.cpp
index a55efbc173..a74355e1c0 100644
--- a/ui/qt/firewall_rules_dialog.cpp
+++ b/ui/qt/firewall_rules_dialog.cpp
@@ -172,7 +172,7 @@ void FirewallRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
.arg(firewall_product_name(prod_));
QByteArray file_name = WiresharkFileDialog::getSaveFileName(this,
save_title,
- mainApp->lastOpenDir().canonicalPath(),
+ mainApp->openDialogInitialDir().canonicalPath(),
tr("Text file (*.txt);;All Files (" ALL_FILES_WILDCARD ")")
).toUtf8();
if (file_name.length() > 0) {