Commit 58b5da01 authored by charras's avatar charras
Browse files

Fixed bug 2982182 PCBNew File - Revert function don't work.

parent 04a18c10
Loading
Loading
Loading
Loading
−9.18 KiB (213 KiB)

File changed.

No diff preview for this file type.

−12.4 KiB (306 KiB)

File changed.

No diff preview for this file type.

+6 −4
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@
#include "protos.h"
#include "protos.h"
#include "pcbnew_id.h"
#include "pcbnew_id.h"


#define BACKUP_FILE_EXT wxT( "000" )


void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{
{
@@ -63,7 +64,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
        else
        else
        {
        {
            fn = GetScreen()->m_FileName;
            fn = GetScreen()->m_FileName;
            fn.SetExt( wxT( "000" ) );
            fn.SetExt( BACKUP_FILE_EXT );
        }
        }


        if( !fn.FileExists() )
        if( !fn.FileExists() )
@@ -333,15 +334,16 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )


    /* Get the backup file name */
    /* Get the backup file name */
    backupFileName = pcbFileName;
    backupFileName = pcbFileName;
    backupFileName.SetExt( wxT( "000" ) );
    backupFileName.SetExt( BACKUP_FILE_EXT );


    /* If an old backup file exists, delete it.
    /* If an old backup file exists, delete it.
    if an old board file existes, rename it to the backup file name
    if an old board file existes, rename it to the backup file name
    */
    */
    if( backupFileName.FileExists() )
    if( pcbFileName.FileExists() )
    {
    {
        /* rename the "old" file" from xxx.brd to xxx.000 */
        /* rename the "old" file" from xxx.brd to xxx.000 */
        wxRemoveFile( backupFileName.GetFullPath() ); /* Remove the old file xxx.000 (if exists) */
        if( backupFileName.FileExists() )    /* Remove the old file xxx.000 (if exists) */
            wxRemoveFile( backupFileName.GetFullPath() );
        if( !wxRenameFile( pcbFileName.GetFullPath(),
        if( !wxRenameFile( pcbFileName.GetFullPath(),
                           backupFileName.GetFullPath() ) )
                           backupFileName.GetFullPath() ) )
        {
        {