Test the directory opened explicitly to silence assert

Fixes KICAD-6FY
This commit is contained in:
Marek Roszko 2024-01-23 22:37:03 -05:00
parent c143be6279
commit a85478df97
1 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,8 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
importProj.m_TargetProj.MakeAbsolute();
// Check if the project directory is empty
if( wxDir( targetDir ).HasFiles() )
wxDir targetDirTest( targetDir );
if( targetDirTest.IsOpened() && targetDirTest.HasFiles() )
{
msg = _( "The selected directory is not empty. We recommend you "
"create projects in their own clean directory.\n\nDo you "
@ -112,6 +113,8 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
}
}
targetDirTest.Close();
CreateNewProject( importProj.m_TargetProj.GetFullPath(), false /* Don't create stub files */ );
LoadProject( importProj.m_TargetProj );