followup of 3f69799047
- improved path checks
This commit is contained in:
parent
dae9538eaf
commit
617747acb3
1 changed files with 14 additions and 4 deletions
|
@ -191,17 +191,27 @@ AppUpdateDownloadDialog::AppUpdateDownloadDialog( const Semver& ver_online, boos
|
|||
boost::filesystem::path path = boost::filesystem::path(txtctrl_path->GetValue().ToUTF8().data()) / GUI::format(filename);
|
||||
boost::system::error_code ec;
|
||||
if (path.parent_path().string().empty()) {
|
||||
MessageDialog msgdlg(nullptr, _L("Directory path is empty."), _L("Notice"), wxYES_NO);
|
||||
MessageDialog msgdlg(nullptr, _L("Directory path is empty."), _L("Notice"), wxOK);
|
||||
msgdlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
ec.clear();
|
||||
if (!boost::filesystem::exists(path.parent_path(), ec) || !boost::filesystem::is_directory(path.parent_path(),ec) || ec) {
|
||||
ec.clear();
|
||||
if (!boost::filesystem::exists(path.parent_path().parent_path(), ec) || !boost::filesystem::is_directory(path.parent_path().parent_path(), ec) || ec) {
|
||||
MessageDialog msgdlg(nullptr, _L("Directory path is incorrect."), _L("Notice"), wxOK);
|
||||
msgdlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
MessageDialog msgdlg(nullptr, GUI::format_wxstr(_L("Directory %1% doesn't exists. Do you wish to create it?"), GUI::format_wxstr(path.parent_path().string())), _L("Notice"), wxYES_NO);
|
||||
if (msgdlg.ShowModal() != wxID_YES)
|
||||
return;
|
||||
if(!boost::filesystem::create_directory(path.parent_path()))
|
||||
ec.clear();
|
||||
if(!boost::filesystem::create_directory(path.parent_path(), ec) || ec)
|
||||
{
|
||||
MessageDialog msgdlg(nullptr, _L("Failed to creeate directory."), _L("Notice"), wxYES_NO);
|
||||
MessageDialog msgdlg(nullptr, _L("Failed to create directory."), _L("Notice"), wxOK);
|
||||
msgdlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue