kicad: create zip archive: test for write file error

This commit is contained in:
jean-pierre charras 2017-07-24 09:20:44 +02:00
parent cb2f3d6304
commit 622ba4f11b
1 changed files with 8 additions and 1 deletions

View File

@ -166,7 +166,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
wxString currdirname = fileName.GetPathWithSep();
wxDir dir( currdirname );
if( !dir.IsOpened() )
if( !dir.IsOpened() ) // wxWidgets display a error message on issue.
return;
wxSetWorkingDirectory( currdirname );
@ -175,6 +175,13 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
wxString zipfilename = zip.GetFullPath();
wxFFileOutputStream ostream( zipfilename );
if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir
{
wxMessageBox( wxString::Format( _( "Unable to create zip archive file '%s'" ), zipfilename ) );
return;
}
wxZipOutputStream zipstream( ostream );
// Build list of filenames to put in zip archive