Fix class/struct confusion causing build error on macOS.
[dcpomatic.git] / src / wx / file_picker_ctrl.cc
index 284f7bc99336d93dd9ad80a5c6fbc3e4c181d04c..4bb6518efc2fe33a91ac26812a701a5fba9bd55e 100644 (file)
@@ -61,7 +61,7 @@ FilePickerCtrl::SetPath (wxString p)
        _path = p;
 
        if (!_path.IsEmpty ()) {
-               _file->SetLabel (std_to_wx (filesystem::path (wx_to_std (_path)).leaf().string()));
+               _file->SetLabel(std_to_wx(filesystem::path(wx_to_std(_path)).filename().string()));
        } else {
                _file->SetLabel (_("(None)"));
        }
@@ -83,12 +83,11 @@ FilePickerCtrl::browse_clicked ()
        if (_warn_overwrite) {
                style |= wxFD_OVERWRITE_PROMPT;
        }
-       wxFileDialog* d = new wxFileDialog (this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
-       d->SetPath (_path);
-       if (d->ShowModal () == wxID_OK) {
-               SetPath (d->GetPath ());
+       wxFileDialog dialog(this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
+       dialog.SetPath(_path);
+       if (dialog.ShowModal() == wxID_OK) {
+               SetPath(dialog.GetPath());
        }
-       d->Destroy ();
 }
 
 void