Skip to content

Commit

Permalink
#432 windows update doesn't work
Browse files Browse the repository at this point in the history
The downloaded and backuped files should be cleaned before upgrade.
  • Loading branch information
lixun910 committed May 22, 2016
1 parent 45c8c38 commit cc4dc20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DialogTools/AutoUpdateDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event )
wxString backup_file_name = file_name + ".backup";
int size = wxAtoi(file_size);

wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);

if (DownloadUrl(file_url.mb_str(), update_file_name.mb_str())){
// check file size
Expand All @@ -386,8 +388,11 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event )

// replace the old file
wxRenameFile(file_name, backup_file_name);
wxRename(update_file_name, file_name);
wxRenameFile(update_file_name, file_name);

wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);

success = true;
}
progressDlg.Update(current_job++);
Expand Down

0 comments on commit cc4dc20

Please sign in to comment.