Fix loading old (2007) symbol cache library files.
(cherry picked from commit f5186da1e5)
This commit is contained in:
@@ -471,6 +471,27 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
|
||||
errorMsg += tmp;
|
||||
}
|
||||
|
||||
// Back up the old (2007) cache library.
|
||||
srcFileName.SetPath( Prj().GetProjectPath() );
|
||||
srcFileName.SetName( Prj().GetProjectName() + wxS( ".cache" ) );
|
||||
srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
|
||||
destFileName = srcFileName;
|
||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||
destFileName.AppendDir( backupFolder );
|
||||
|
||||
aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
|
||||
srcFileName.GetFullPath(),
|
||||
destFileName.GetFullPath() ),
|
||||
RPT_SEVERITY_INFO );
|
||||
|
||||
if( srcFileName.Exists()
|
||||
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
||||
{
|
||||
errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
|
||||
srcFileName.GetFullPath() );
|
||||
}
|
||||
|
||||
// Back up the rescue symbol library if it exists.
|
||||
srcFileName.SetName( Prj().GetProjectName() + wxS( "-rescue" ) );
|
||||
destFileName.SetName( srcFileName.GetName() + timeStamp );
|
||||
|
||||
@@ -485,13 +485,20 @@ void SYMBOL_LIBS::SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths
|
||||
|
||||
const wxString SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename )
|
||||
{
|
||||
wxFileName name = aFullProjectFilename;
|
||||
wxFileName filename( aFullProjectFilename );
|
||||
wxString name = filename.GetName();
|
||||
|
||||
name.SetName( name.GetName() + "-cache" );
|
||||
name.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
filename.SetName( name + "-cache" );
|
||||
filename.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
|
||||
if( name.FileExists() )
|
||||
return name.GetFullPath();
|
||||
if( filename.FileExists() )
|
||||
return filename.GetFullPath();
|
||||
|
||||
// Try the old (2007) cache name
|
||||
filename.SetName( name + ".cache" );
|
||||
|
||||
if( filename.FileExists() )
|
||||
return filename.GetFullPath();
|
||||
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user