Commit 58b5da01 authored by charras's avatar charras

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

parent 04a18c10
...@@ -13,6 +13,7 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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() ) )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment