mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
Check wx dialogs aren't returning blank paths (#845)
This commit is contained in:
parent
6073ab3ec6
commit
ae4cb45cf3
@ -637,7 +637,7 @@ void MainWindow::OnFileMenu(wxCommandEvent& event)
|
||||
|
||||
wxFileDialog openFileDialog(this, _("Open file to launch"), wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty())
|
||||
return;
|
||||
|
||||
const wxString wxStrFilePath = openFileDialog.GetPath();
|
||||
@ -674,7 +674,7 @@ void MainWindow::OnInstallUpdate(wxCommandEvent& event)
|
||||
{
|
||||
wxDirDialog openDirDialog(nullptr, _("Select folder of title to install"), "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _("Select the folder that stores your update, DLC or base game files"));
|
||||
int modalChoice = openDirDialog.ShowModal();
|
||||
if (modalChoice == wxID_CANCEL)
|
||||
if (modalChoice == wxID_CANCEL || openDirDialog.GetPath().IsEmpty())
|
||||
break;
|
||||
if (modalChoice == wxID_OK)
|
||||
{
|
||||
@ -715,7 +715,7 @@ void MainWindow::OnNFCMenu(wxCommandEvent& event)
|
||||
wxFileDialog
|
||||
openFileDialog(this, _("Open file to load"), "", "",
|
||||
"All NFC files (bin, dat, nfc)|*.bin;*.dat;*.nfc|All files (*.*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); // TRANSLATE
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty())
|
||||
return;
|
||||
wxString wxStrFilePath = openFileDialog.GetPath();
|
||||
uint32 nfcError;
|
||||
|
@ -367,7 +367,7 @@ void TitleManager::OnRefreshButton(wxCommandEvent& event)
|
||||
void TitleManager::OnInstallTitle(wxCommandEvent& event)
|
||||
{
|
||||
wxFileDialog openFileDialog(this, _("Select title to install"), "", "", "meta.xml|meta.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL || openFileDialog.GetPath().IsEmpty())
|
||||
return;
|
||||
|
||||
fs::path filePath(openFileDialog.GetPath().wc_str());
|
||||
@ -623,13 +623,10 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
|
||||
const auto persistent_id = (uint32)(uintptr_t)m_save_account_list->GetClientData(selection_index);
|
||||
|
||||
wxFileDialog path_dialog(this, _("Select a target file to export the save entry"), entry->path.string(), wxEmptyString, "Exported save entry (*.zip)|*.zip", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (path_dialog.ShowModal() != wxID_OK)
|
||||
if (path_dialog.ShowModal() != wxID_OK || path_dialog.GetPath().IsEmpty())
|
||||
return;
|
||||
|
||||
const auto path = path_dialog.GetPath();
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
int ze;
|
||||
auto* zip = zip_open(path.ToUTF8().data(), ZIP_CREATE | ZIP_TRUNCATE, &ze);
|
||||
if (!zip)
|
||||
|
@ -375,7 +375,7 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId)
|
||||
// ask the user to provide a path for the output file
|
||||
wxFileDialog saveFileDialog(this, _("Save Wii U game archive file"), defaultDir, wxHelper::FromUtf8(defaultFileName),
|
||||
"WUA files (*.wua)|*.wua", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (saveFileDialog.ShowModal() == wxID_CANCEL)
|
||||
if (saveFileDialog.ShowModal() == wxID_CANCEL || saveFileDialog.GetPath().IsEmpty())
|
||||
return;
|
||||
fs::path outputPath(wxHelper::MakeFSPath(saveFileDialog.GetPath()));
|
||||
fs::path outputPathTmp(wxHelper::MakeFSPath(saveFileDialog.GetPath().append("__tmp")));
|
||||
|
Loading…
Reference in New Issue
Block a user