Make sure JSON contents are in memory before saving.

Fixes https://gitlab.com/kicad/code/kicad/issues/9582
This commit is contained in:
Jeff Young 2021-11-09 20:17:23 +00:00
parent 0dcbfa2b69
commit bc30ee85c0
1 changed files with 5 additions and 0 deletions

View File

@ -392,11 +392,13 @@ public:
else if( ext == ProjectFileExtension )
{
PROJECT_FILE projectFile( aSrcFilePath );
projectFile.LoadFromFile();
projectFile.SaveAs( destFile.GetPath(), destFile.GetName() );
}
else if( ext == ProjectLocalSettingsFileExtension )
{
PROJECT_LOCAL_SETTINGS projectLocalSettings( nullptr, aSrcFilePath );
projectLocalSettings.LoadFromFile();
projectLocalSettings.SaveAs( destFile.GetPath(), destFile.GetName() );
}
}
@ -540,6 +542,9 @@ int KICAD_MANAGER_CONTROL::SaveProjectAs( const TOOL_EVENT& aEvent )
wxString default_dir = m_frame->GetMruPath();
Prj().GetProjectFile().SaveToFile();
Prj().GetLocalSettings().SaveToFile();
if( default_dir == currentProjectDirPath
|| default_dir == currentProjectDirPath + wxFileName::GetPathSeparator() )
{