-};
-
-void wxDirDialog::OnOK( wxCommandEvent& WXUNUSED(event) )
-{
- m_path = m_input->GetValue();
- // Does the path exist? (User may have typed anything in m_input)
- if (wxPathExists(m_path)) {
- // OK, path exists, we're done.
- EndModal(wxID_OK);
- return;
- }
- // Interact with user, find out if the dir is a typo or to be created
- wxString msg( _("The directory ") );
- msg = msg + m_path;
- msg = msg + _("\ndoes not exist\nCreate it now?") ;
- wxMessageDialog dialog(this, msg, _("Directory does not exist"), wxYES_NO | wxICON_WARNING );
- if ( dialog.ShowModal() == wxID_YES ) {
- // Okay, let's make it
- wxLogNull log;
- if (wxMkdir(m_path)) {
- // The new dir was created okay.
- EndModal(wxID_OK);
- return;
- }
- else {
- // Trouble...
- msg = _("Failed to create directory ")+m_path+
- _("\n(Do you have the required permissions?)");
- wxMessageDialog errmsg(this, msg, _("Error creating directory"), wxOK | wxICON_ERROR);
- errmsg.ShowModal();
- // We still don't have a valid dir. Back to the main dialog.
- }
- }
- // User has answered NO to create dir.