Update kicad_prl file when doing a SaveAs.
Fixes https://gitlab.com/kicad/code/kicad/issues/9455
This commit is contained in:
parent
92e2f51f57
commit
d4e3e67b8d
|
@ -341,6 +341,15 @@ bool PROJECT_LOCAL_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce
|
|||
}
|
||||
|
||||
|
||||
bool PROJECT_LOCAL_SETTINGS::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
||||
{
|
||||
Set( "meta.filename", aFile + "." + ProjectLocalSettingsFileExtension );
|
||||
SetFilename( aFile );
|
||||
|
||||
return JSON_SETTINGS::SaveToFile( aDirectory, true );
|
||||
}
|
||||
|
||||
|
||||
const PROJECT_FILE_STATE* PROJECT_LOCAL_SETTINGS::GetFileState( const wxString& aFileName )
|
||||
{
|
||||
auto it = std::find_if( m_files.begin(), m_files.end(),
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
|
||||
bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
||||
|
||||
bool SaveAs( const wxString& aDirectory, const wxString& aFile );
|
||||
|
||||
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
|
||||
|
||||
void SetProject( PROJECT* aProject )
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <kicad_manager_frame.h>
|
||||
#include <confirm.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/project_local_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <tool/selection.h>
|
||||
#include <tool/tool_event.h>
|
||||
|
@ -363,7 +364,9 @@ public:
|
|||
wxString ext = destFile.GetExt();
|
||||
bool atRoot = destFile.GetPath() == m_projectDirPath;
|
||||
|
||||
if( ext == LegacyProjectFileExtension || ext == ProjectFileExtension )
|
||||
if( ext == LegacyProjectFileExtension
|
||||
|| ext == ProjectFileExtension
|
||||
|| ext == ProjectLocalSettingsFileExtension )
|
||||
{
|
||||
wxString destPath = destFile.GetPath();
|
||||
|
||||
|
@ -377,7 +380,7 @@ public:
|
|||
{
|
||||
destFile.SetName( m_newProjectName );
|
||||
|
||||
if( atRoot )
|
||||
if( atRoot && ext != ProjectLocalSettingsFileExtension )
|
||||
m_newProjectFile = destFile;
|
||||
}
|
||||
|
||||
|
@ -386,11 +389,16 @@ public:
|
|||
// All paths in the settings file are relative so we can just do a straight copy
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
|
||||
}
|
||||
else
|
||||
else if( ext == ProjectFileExtension )
|
||||
{
|
||||
PROJECT_FILE projectFile( aSrcFilePath );
|
||||
projectFile.SaveAs( destFile.GetPath(), destFile.GetName() );
|
||||
}
|
||||
else if( ext == ProjectLocalSettingsFileExtension )
|
||||
{
|
||||
PROJECT_LOCAL_SETTINGS projectLocalSettings( nullptr, aSrcFilePath );
|
||||
projectLocalSettings.SaveAs( destFile.GetPath(), destFile.GetName() );
|
||||
}
|
||||
}
|
||||
else if( ext == KiCadSchematicFileExtension
|
||||
|| ext == KiCadSchematicFileExtension + BackupFileSuffix
|
||||
|
|
Loading…
Reference in New Issue