Fully resolve path list for Kicad2Step.

Fixes https://gitlab.com/kicad/code/kicad/issues/7670
This commit is contained in:
Jeff Young 2021-08-14 11:21:03 +01:00
parent 507b386c79
commit ed38028eaf
2 changed files with 14 additions and 6 deletions

View File

@ -601,7 +601,7 @@ bool FILENAME_RESOLVER::readPathList()
bool FILENAME_RESOLVER::WritePathList( const wxString& aDir, const wxString& aFilename,
bool aWriteFullList )
bool aResolvePaths )
{
if( aDir.empty() )
{
@ -617,9 +617,10 @@ bool FILENAME_RESOLVER::WritePathList( const wxString& aDir, const wxString& aFi
std::list<SEARCH_PATH>::const_iterator sPL = m_paths.begin();
// skip all ${ENV_VAR} alias names
if( !aWriteFullList )
if( !aResolvePaths )
{
// skip all ${ENV_VAR} alias names
while( sPL != m_paths.end()
&& ( sPL->m_Alias.StartsWith( "${" ) || sPL->m_Alias.StartsWith( "$(" ) ) )
{
@ -652,10 +653,17 @@ bool FILENAME_RESOLVER::WritePathList( const wxString& aDir, const wxString& aFi
{
tstr = sPL->m_Alias.ToUTF8();
cfgFile << "\"" << tstr.size() << ":" << tstr << "\",";
tstr = sPL->m_Pathvar.ToUTF8();
if( aResolvePaths )
tstr = ResolvePath( sPL->m_Pathvar ).ToUTF8();
else
tstr = sPL->m_Pathvar.ToUTF8();
cfgFile << "\"" << tstr.size() << ":" << tstr << "\",";
tstr = sPL->m_Description.ToUTF8();
cfgFile << "\"" << tstr.size() << ":" << tstr << "\"\n";
++sPL;
}

View File

@ -91,9 +91,9 @@ public:
/**
* Write the current path list to a config file.
* @param aWriteFullList indicates whether env vars should also be written out or not
* @param aResolvePaths indicates whether env vars should also be written out or not
*/
bool WritePathList( const wxString& aDir, const wxString& aFilename, bool aWriteFullList );
bool WritePathList( const wxString& aDir, const wxString& aFilename, bool aResolvePaths );
/**
* Determines the full path of the given file name.