Remember some more paths when selecting files (#2728).
[dcpomatic.git] / src / wx / file_dialog.cc
index bed8b4e0d2c32e1c8776026cc47c7f6c17fd2d7f..5a530359c25bbcfe35880d2bbd59589e6b26ac69 100644 (file)
 #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
                )