Don't create new project on save as when project file already exists.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10625
This commit is contained in:
Wayne Stambaugh 2022-02-05 11:30:21 -05:00
parent 471c0c4c1d
commit c875af48e7
1 changed files with 7 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 CERN * Copyright (C) 2019 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -366,8 +366,8 @@ public:
bool atRoot = destFile.GetPath() == m_projectDirPath; bool atRoot = destFile.GetPath() == m_projectDirPath;
if( ext == LegacyProjectFileExtension if( ext == LegacyProjectFileExtension
|| ext == ProjectFileExtension || ext == ProjectFileExtension
|| ext == ProjectLocalSettingsFileExtension ) || ext == ProjectLocalSettingsFileExtension )
{ {
wxString destPath = destFile.GetPath(); wxString destPath = destFile.GetPath();
@ -484,7 +484,7 @@ public:
wxUniChar pathSep = wxFileName::GetPathSeparator(); wxUniChar pathSep = wxFileName::GetPathSeparator();
if( destDirPath.StartsWith( m_projectDirPath + pathSep ) if( destDirPath.StartsWith( m_projectDirPath + pathSep )
|| destDirPath.StartsWith( m_projectDirPath + PROJECT_BACKUPS_DIR_SUFFIX ) ) || destDirPath.StartsWith( m_projectDirPath + PROJECT_BACKUPS_DIR_SUFFIX ) )
{ {
destDirPath.Replace( m_projectDirPath, m_newProjectDirPath, false ); destDirPath.Replace( m_projectDirPath, m_newProjectDirPath, false );
destDir.SetPath( destDirPath ); destDir.SetPath( destDirPath );
@ -603,11 +603,10 @@ int KICAD_MANAGER_CONTROL::SaveProjectAs( const TOOL_EVENT& aEvent )
if( !traverser.GetErrors().empty() ) if( !traverser.GetErrors().empty() )
DisplayErrorMessage( m_frame, traverser.GetErrors() ); DisplayErrorMessage( m_frame, traverser.GetErrors() );
if( traverser.GetNewProjectFile().FileExists() ) if( !traverser.GetNewProjectFile().FileExists() )
{
m_frame->CreateNewProject( traverser.GetNewProjectFile() ); m_frame->CreateNewProject( traverser.GetNewProjectFile() );
m_frame->LoadProject( traverser.GetNewProjectFile() );
} m_frame->LoadProject( traverser.GetNewProjectFile() );
return 0; return 0;
} }