@ -36,6 +36,7 @@
# include <wx/filename.h>
# include <wx/filename.h>
# include <wx/log.h>
# include <wx/log.h>
# include <wx/menu.h>
# include <wx/menu.h>
# include <wx/wfstream.h>
/* ---------- GRID_TRICKS for embedded files grid ---------- */
/* ---------- GRID_TRICKS for embedded files grid ---------- */
@ -445,9 +446,10 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
if ( skip_file )
if ( skip_file )
continue ;
continue ;
wxFFile ffile ( fileName . GetFullPath ( ) , wxT ( " w " ) ) ;
if ( ! ffile . IsOpened ( ) )
wxFFileOutputStream out ( fileName . GetFullPath ( ) ) ;
if ( ! out . IsOk ( ) )
{
{
wxString msg = wxString : : Format ( _ ( " Failed to open file '%s'. " ) ,
wxString msg = wxString : : Format ( _ ( " Failed to open file '%s'. " ) ,
fileName . GetFullName ( ) ) ;
fileName . GetFullName ( ) ) ;
@ -457,12 +459,15 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
continue ;
continue ;
}
}
if ( ! ffile . Write ( file - > decompressedData . data ( ) , file - > decompressedData . size ( ) ) )
out . Write ( file - > decompressedData . data ( ) , file - > decompressedData . size ( ) ) ;
if ( ! out . IsOk ( ) | | ( out . LastWrite ( ) ! = file - > decompressedData . size ( ) ) )
{
{
wxString msg = wxString : : Format ( _ ( " Failed to write file '%s'. " ) ,
wxString msg = wxString : : Format ( _ ( " Failed to write file '%s'. " ) ,
fileName . GetFullName ( ) ) ;
fileName . GetFullName ( ) ) ;
KIDIALOG errorDlg ( m_parent , msg , _ ( " Error " ) , wxOK | wxICON_ERROR ) ;
KIDIALOG errorDlg ( m_parent , msg , _ ( " Error " ) , wxOK | wxICON_ERROR ) ;
errorDlg . ShowModal ( ) ;
errorDlg . ShowModal ( ) ;
}
}
}
}