May need to convert to UNIX style paths twice (before & after resolving).

Fixes https://gitlab.com/kicad/code/kicad/issues/13591
This commit is contained in:
Jeff Young 2023-01-20 18:05:32 +00:00
parent f7ebaf1bab
commit 3e55719831
1 changed files with 8 additions and 4 deletions

View File

@ -554,16 +554,15 @@ void NETLIST_EXPORTER_SPICE::writeInclude( OUTPUTFORMATTER& aFormatter, unsigned
// First, expand env vars, if any.
wxString expandedPath = ExpandEnvVarSubstitutions( aPath, &m_schematic->Prj() );
// Handle windows paths
expandedPath.Replace( wxS( "\\" ), wxS( "/" ) );
// Path may have been authored by someone on a Windows box; convert it to UNIX format
expandedPath.Replace( '\\', '/' );
wxString fullPath;
if( aNetlistOptions & OPTION_ADJUST_INCLUDE_PATHS )
{
// Look for the library in known search locations.
fullPath = ResolveFile( expandedPath, &Pgm().GetLocalEnvVariables(),
&m_schematic->Prj() );
fullPath = ResolveFile( expandedPath, &Pgm().GetLocalEnvVariables(), &m_schematic->Prj() );
if( fullPath.IsEmpty() )
{
@ -572,6 +571,11 @@ void NETLIST_EXPORTER_SPICE::writeInclude( OUTPUTFORMATTER& aFormatter, unsigned
expandedPath ) );
fullPath = expandedPath;
}
else if( wxFileName::GetPathSeparator() == '\\' )
{
// Convert it to UNIX format (again) if ResolveFile() returned a Windows style path
fullPath.Replace( '\\', '/' );
}
}
else
{