X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffile_dialog.cc;h=5a530359c25bbcfe35880d2bbd59589e6b26ac69;hb=127bdaa2d8a869112fd6ec908cf115f391dbba24;hp=bed8b4e0d2c32e1c8776026cc47c7f6c17fd2d7f;hpb=c64b6891f6e28c1a7f11871d3dcccdfe75944644;p=dcpomatic.git 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 )