Allow optional override of the initial path taken from the key.
[dcpomatic.git] / src / wx / file_dialog.cc
index 7aee394937aa59c411949cf52991e8022c961597..b65077784747ca57f90404a9e87cf3d9cc8f186b 100644 (file)
@@ -28,6 +28,7 @@
 
 
 using std::vector;
+using boost::optional;
 
 
 FileDialog::FileDialog(
@@ -35,12 +36,16 @@ FileDialog::FileDialog(
        wxString title,
        wxString allowed,
        long style,
-       std::string initial_path_key
+       std::string initial_path_key,
+       optional<boost::filesystem::path> override_path
        )
        : wxFileDialog(
                parent,
                title,
-               std_to_wx(Config::instance()->initial_path(initial_path_key).get_value_or(home_directory()).string()),
+               std_to_wx(
+                       override_path.get_value_or(
+                               Config::instance()->initial_path(initial_path_key).get_value_or(home_directory())
+                               ).string()),
                wxEmptyString,
                allowed,
                style