From 45085123432014df820fa8f05f69a3e833b32d29 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Thu, 15 Feb 2024 21:46:00 +0100 Subject: [PATCH] Sanitise filename before saving footprint library --- pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 954c6c547a..489087a9f1 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -2748,10 +2748,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 );