void ModEditWindow::OnExportClicked(wxCommandEvent& event) { ExportInstWizard *exportWizard = new ExportInstWizard(this, this->m_inst); exportWizard->Start(); wxString fileName; wxFileDialog *chooseFileDlg = new wxFileDialog(this, _("Save..."), wxGetCwd(), wxEmptyString, _("*.zip"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (chooseFileDlg->ShowModal() == wxID_OK) { fileName = chooseFileDlg->GetPath(); } else { return; } wxString packName = exportWizard->GetPackName(); wxString packNotes = exportWizard->GetPackNotes(); wxArrayString includedConfigs; exportWizard->GetIncludedConfigs(&includedConfigs); exportWizard->Destroy(); m_mainWin->BuildConfPack(m_inst, packName, packNotes, fileName, includedConfigs); }
void ModEditWindow::OnExportClicked(wxCommandEvent& event) { ExportInstWizard *exportWizard = new ExportInstWizard(this, this->m_inst); if(!exportWizard->Start()) return; wxString fileName; wxString defaultPath = wxGetCwd(); wxFileName file; // We have to do this because of buggy wx. // See: http://trac.wxwidgets.org/ticket/9917 #ifdef __WXGTK__ repeat_filepicker: wxFileDialog chooseFileDlg (this, "Save...", defaultPath, wxEmptyString, "*.zip", wxFD_SAVE); if (chooseFileDlg.ShowModal() == wxID_OK) { file = chooseFileDlg.GetPath(); file.SetExt("zip"); if(file.FileExists()) { int res = wxMessageBox("Do you want to overwrite the original file?","Overwrite file?",wxYES_NO|wxICON_QUESTION,this); if(res == wxNO) { defaultPath = file.GetPath(); goto repeat_filepicker; } } } else { return; } #else wxFileDialog chooseFileDlg(this, "Save...", defaultPath, wxEmptyString, "*.zip", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (chooseFileDlg.ShowModal() == wxID_OK) { file = chooseFileDlg.GetPath(); } else { return; } #endif wxString packName = exportWizard->GetPackName(); wxString packNotes = exportWizard->GetPackNotes(); wxArrayString includedConfigs; exportWizard->GetIncludedConfigs(&includedConfigs); exportWizard->Destroy(); m_mainWin->BuildConfPack(m_inst, packName, packNotes, file.GetFullPath(), includedConfigs); }