Update backups folder name when doing project save as.

Fixes https://gitlab.com/kicad/code/kicad/issues/9254
This commit is contained in:
Jeff Young 2021-09-27 13:24:11 +01:00
parent 7a879c6a2d
commit c05e4376f9
3 changed files with 8 additions and 6 deletions

View File

@ -47,10 +47,6 @@
#include <wildcards_and_files_ext.h>
/// Project settings path will be <projectname> + this
#define PROJECT_BACKUPS_DIR_SUFFIX wxT( "-backups" )
SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) :
m_headless( aHeadless ),
m_kiway( nullptr ),

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
@ -35,6 +35,10 @@ class REPORTER;
class wxSingleInstanceChecker;
/// Project settings path will be <projectname> + this
#define PROJECT_BACKUPS_DIR_SUFFIX wxT( "-backups" )
class SETTINGS_MANAGER
{
public:

View File

@ -24,6 +24,7 @@
#include <kiway.h>
#include <kicad_manager_frame.h>
#include <confirm.h>
#include <settings/settings_manager.h>
#include <tool/selection.h>
#include <tool/tool_event.h>
#include <tools/kicad_manager_actions.h>
@ -465,7 +466,8 @@ public:
wxString destDirPath = destDir.GetPathWithSep();
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.Replace( m_projectDirPath, m_newProjectDirPath, false );
destDir.SetPath( destDirPath );