Skip to content

Commit

Permalink
Persist even if some individual message files can't be found
Browse files Browse the repository at this point in the history
Notify the user of however many were missing at the end
  • Loading branch information
smowton committed Apr 11, 2019
1 parent bba948a commit 1ef0575
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Source/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ enum INCREDIMAIL_VERSIONS incredimail_version;
messages_dir.erase(truncate_off);
messages_dir.append("\\Messages");

std::size_t n_failures = 0;

for( i = 0; i < e_count; i++ ) {
offset = 0;

Expand Down Expand Up @@ -631,9 +633,7 @@ enum INCREDIMAIL_VERSIONS incredimail_version;
message_attachment_dir = messages_dir + "\\" + subfolder + "\\" + headerid + "\\Attachments";

if (!CopyFile(source_path.c_str(), temp_filename, FALSE)) {
MessageBox(global_hwnd, "Failed copying IML file!", "Error!", MB_OK);
sqlite3_close(db);
return;
++n_failures;
}

}
Expand Down Expand Up @@ -680,6 +680,11 @@ enum INCREDIMAIL_VERSIONS incredimail_version;
sprintf_s( debug_str, MAX_CHAR, "%d of %d DONE!",i ,e_count );
SetDlgItemText( global_hwnd, IDC_XOFX, debug_str );

if (n_failures != 0) {
std::string complaint = "Couldn't find " + std::to_string(n_failures) + " out of " + std::to_string(e_count) + " expected message files";
MessageBox(global_hwnd, complaint.c_str(), "Error!", MB_OK);
}

}
email_thread = THREAD_COMPLETED;
}
Expand Down

0 comments on commit 1ef0575

Please sign in to comment.