From 127bdaa2d8a869112fd6ec908cf115f391dbba24 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 16 Jan 2024 01:44:49 +0100 Subject: Remember some more paths when selecting files (#2728). * export subtitles * export video * debug log * cinema database * config file --- src/wx/file_dialog.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/wx/file_dialog.cc') diff --git a/src/wx/file_dialog.cc b/src/wx/file_dialog.cc index bed8b4e0d..5a530359c 100644 --- a/src/wx/file_dialog.cc +++ b/src/wx/file_dialog.cc @@ -27,26 +27,38 @@ #include +using std::string; using std::vector; using boost::optional; +wxString initial_path( + std::string initial_path_key, + optional override_path + ) +{ + if (override_path) { + return std_to_wx(override_path->string()); + } + + return std_to_wx(Config::instance()->initial_path(initial_path_key).get_value_or(home_directory()).string()); +} + + FileDialog::FileDialog( wxWindow* parent, wxString title, wxString allowed, long style, std::string initial_path_key, + boost::optional initial_filename, optional override_path ) : wxFileDialog( parent, title, - std_to_wx( - override_path.get_value_or( - Config::instance()->initial_path(initial_path_key).get_value_or(home_directory()) - ).string()), - wxEmptyString, + initial_path(initial_path_key, override_path), + std_to_wx(initial_filename.get_value_or("")), allowed, style ) -- cgit v1.2.3