Update "simple" MRU paths in project Save As.
Update only those that are the project name + extension. Fixes https://gitlab.com/kicad/code/kicad/issues/14681
This commit is contained in:
parent
86c75cf261
commit
329025f8a7
|
@ -569,9 +569,26 @@ bool PROJECT_FILE::SaveToFile( const wxString& aDirectory, bool aForce )
|
||||||
|
|
||||||
bool PROJECT_FILE::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
bool PROJECT_FILE::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
||||||
{
|
{
|
||||||
|
wxFileName oldFilename( GetFilename() );
|
||||||
|
wxString oldProjectName = oldFilename.GetName();
|
||||||
|
|
||||||
Set( "meta.filename", aFile + "." + ProjectFileExtension );
|
Set( "meta.filename", aFile + "." + ProjectFileExtension );
|
||||||
SetFilename( aFile );
|
SetFilename( aFile );
|
||||||
|
|
||||||
|
auto updatePath =
|
||||||
|
[&]( wxString& aPath )
|
||||||
|
{
|
||||||
|
if( aPath.StartsWith( oldProjectName + wxS( "." ) ) )
|
||||||
|
aPath.Replace( oldProjectName, aFile, false );
|
||||||
|
};
|
||||||
|
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_NETLIST ] );
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_STEP ] );
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_IDF ] );
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_VRML ] );
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_SPECCTRADSN ] );
|
||||||
|
updatePath( m_PcbLastPath[ LAST_PATH_GENCAD ] );
|
||||||
|
|
||||||
// While performing Save As, we have already checked that we can write to the directory
|
// While performing Save As, we have already checked that we can write to the directory
|
||||||
// so don't carry the previous flag
|
// so don't carry the previous flag
|
||||||
SetReadOnly( false );
|
SetReadOnly( false );
|
||||||
|
|
Loading…
Reference in New Issue