Add FileDialog::path().
[dcpomatic.git] / src / wx / file_dialog.cc
index 7aee394937aa59c411949cf52991e8022c961597..bed8b4e0d2c32e1c8776026cc47c7f6c17fd2d7f 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
@@ -51,6 +56,13 @@ FileDialog::FileDialog(
 }
 
 
+boost::filesystem::path
+FileDialog::path() const
+{
+       return wx_to_std(GetPath());
+}
+
+
 vector<boost::filesystem::path>
 FileDialog::paths() const
 {