Sanitise filename before saving footprint library

This commit is contained in:
Roberto Fernandez Bautista 2024-02-15 21:46:00 +01:00
parent 091f9c82e1
commit 01cc91850c
1 changed files with 3 additions and 2 deletions

View File

@ -2666,10 +2666,11 @@ void PCB_IO_KICAD_SEXPR::FootprintSave( const wxString& aLibraryPath, const FOOT
wxString footprintName = aFootprint->GetFPID().GetLibItemName();
FP_CACHE_FOOTPRINT_MAP& footprints = m_cache->GetFootprints();
wxString fpName = aFootprint->GetFPID().GetLibItemName().wx_str();
ReplaceIllegalFileNameChars( fpName, '_' );
// Quietly overwrite footprint and delete footprint file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
FILEEXT::KiCadFootprintFileExtension );
wxFileName fn( aLibraryPath, fpName, FILEEXT::KiCadFootprintFileExtension );
// Write through symlinks, don't replace them
WX_FILENAME::ResolvePossibleSymlinks( fn );