Make sure JSON contents are in memory before saving.
Fixes https://gitlab.com/kicad/code/kicad/issues/9582
This commit is contained in:
parent
0dcbfa2b69
commit
bc30ee85c0
|
@ -392,11 +392,13 @@ public:
|
||||||
else if( ext == ProjectFileExtension )
|
else if( ext == ProjectFileExtension )
|
||||||
{
|
{
|
||||||
PROJECT_FILE projectFile( aSrcFilePath );
|
PROJECT_FILE projectFile( aSrcFilePath );
|
||||||
|
projectFile.LoadFromFile();
|
||||||
projectFile.SaveAs( destFile.GetPath(), destFile.GetName() );
|
projectFile.SaveAs( destFile.GetPath(), destFile.GetName() );
|
||||||
}
|
}
|
||||||
else if( ext == ProjectLocalSettingsFileExtension )
|
else if( ext == ProjectLocalSettingsFileExtension )
|
||||||
{
|
{
|
||||||
PROJECT_LOCAL_SETTINGS projectLocalSettings( nullptr, aSrcFilePath );
|
PROJECT_LOCAL_SETTINGS projectLocalSettings( nullptr, aSrcFilePath );
|
||||||
|
projectLocalSettings.LoadFromFile();
|
||||||
projectLocalSettings.SaveAs( destFile.GetPath(), destFile.GetName() );
|
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();
|
wxString default_dir = m_frame->GetMruPath();
|
||||||
|
|
||||||
|
Prj().GetProjectFile().SaveToFile();
|
||||||
|
Prj().GetLocalSettings().SaveToFile();
|
||||||
|
|
||||||
if( default_dir == currentProjectDirPath
|
if( default_dir == currentProjectDirPath
|
||||||
|| default_dir == currentProjectDirPath + wxFileName::GetPathSeparator() )
|
|| default_dir == currentProjectDirPath + wxFileName::GetPathSeparator() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue