A whole load of UTF-8/-16 confusion fixes for Windows.
[dcpomatic.git] / src / wx / film_editor.cc
index 9cf840614535a7847d774977d3cdb2d396039788..ef35349390573e356ed463ed64581d64f4be22a8 100644 (file)
@@ -731,11 +731,14 @@ FilmEditor::setup_content ()
 void
 FilmEditor::content_add_file_clicked ()
 {
-       wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE);
+       /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
+          non-Latin filenames or paths.
+       */
+       wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
        int const r = d->ShowModal ();
-       d->Destroy ();
 
        if (r != wxID_OK) {
+               d->Destroy ();
                return;
        }
 
@@ -745,8 +748,10 @@ FilmEditor::content_add_file_clicked ()
        /* XXX: check for lots of files here and do something */
 
        for (unsigned int i = 0; i < paths.GetCount(); ++i) {
-               _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
+               _film->examine_and_add_content (content_factory (_film, wx_to_std (d->GetPath ())));
        }
+
+       d->Destroy ();
 }
 
 void