diff options
Diffstat (limited to 'src/wx/file_dialog.cc')
| -rw-r--r-- | src/wx/file_dialog.cc | 22 |
1 files changed, 17 insertions, 5 deletions
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 <vector> +using std::string; using std::vector; using boost::optional; +wxString initial_path( + std::string initial_path_key, + optional<boost::filesystem::path> 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<std::string> initial_filename, optional<boost::filesystem::path> 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 ) |
