Fix bug (typo?) in gestfich.cpp.

Minor enhancement in treeproject_item.cpp
This commit is contained in:
jean-pierre charras 2019-11-19 16:11:28 +01:00
parent 0eee21e450
commit 767d7f2009
2 changed files with 6 additions and 3 deletions

View File

@ -428,7 +428,7 @@ bool DeleteDirectory( const wxString& aDirName, bool aRecurse, bool aIncludeHidd
mainDir.Close();
return false;
}
valid = mainDir.GetNext( &dir );
valid = mainDir.GetNext( &file );
}
mainDir.Close();

View File

@ -126,14 +126,17 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
void TREEPROJECT_ITEM::Delete()
{
bool isDirectory = wxDirExists( GetFileName() );
wxString msg = wxString::Format( _( "Are you sure you want to delete '%s'?" ), GetFileName() );
wxMessageDialog dialog( m_parent, msg, _( "Delete File" ), wxYES_NO | wxICON_QUESTION );
wxMessageDialog dialog( m_parent, msg, isDirectory ? _( "Delete Directory" ) : _( "Delete File" ),
wxYES_NO | wxICON_QUESTION );
if( dialog.ShowModal() == wxID_YES )
{
bool success;
if( !wxDirExists( GetFileName() ) )
if( !isDirectory )
success = wxRemoveFile( GetFileName() );
else
success = DeleteDirectory( GetFileName() );