Rename CopyFile() to KiCopyFile() to avoid name colliding with a windows header.

Using CopyFile() that can collide with a windows header create hard to
understand errors, including link errors.

Renaming this function avoids these strange errors.
This commit is contained in:
jean-pierre charras 2020-10-02 20:36:06 +02:00
parent 8c783687a9
commit b38cef409b
8 changed files with 18 additions and 19 deletions

View File

@ -27,7 +27,6 @@
* @file gestfich.cpp
* @brief Functions for file management
*/
#include <fctsys.h>
#include <wx/mimetype.h>
#include <wx/filename.h>
@ -349,7 +348,7 @@ bool CanPrintFile( const wxString& file )
}
void CopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors )
void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors )
{
if( !wxCopyFile( aSrcPath, aDestPath ) )
{

View File

@ -387,7 +387,7 @@ public:
wxLogTrace( traceSettings, "Copying %s to %s", aSrcFilePath, file.GetFullPath() );
// For now, just copy everything
CopyFile( aSrcFilePath, file.GetFullPath(), m_errors );
KiCopyFile( aSrcFilePath, file.GetFullPath(), m_errors );
return wxDIR_CONTINUE;
}

View File

@ -326,19 +326,19 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
// entire tree with several projects within it), so we leave this as an exercise
// to the author.
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "sym" )
{
// Symbols are not project-specific. Keep their source names.
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "lib" || ext == "dcm" || ext == "kicad_sym" )
{
if( destFile.GetName() == aProjectName + "-cache" )
destFile.SetName( aNewProjectName + "-cache" );
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "net" )
{

View File

@ -161,7 +161,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
destFile.SetName( destFileName );
}
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "gbrjob" )
{
@ -179,7 +179,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
// detect the file format: old (deprecated) gerber format or official JSON format
if( !data.Contains( "{" ) )
{
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
return;
}
@ -235,7 +235,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
destFile.SetName( destFileName );
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else
{

View File

@ -61,11 +61,11 @@ bool CanPrintFile( const wxString& file );
/**
* Function CopyFile
* @param aSrcPath
* @param aDestPath
* @param aSrcPath is the full filename of the source
* @param aDestPath is the full filename of the target
* @param aErrors a wxString to *append* any errors to
*/
void CopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors );
void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors );
/**
* Function EDA_FILE_SELECTOR

View File

@ -373,7 +373,7 @@ public:
// Currently all paths in the settings file are relative, so we can just do a
// straight copy
CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
}
else if( ext == "kicad_sch"
|| ext == "kicad_sch-bak"
@ -432,7 +432,7 @@ public:
if( destName == m_projectName )
destFile.SetName( m_newProjectName );
CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
}
return wxDIR_CONTINUE;

View File

@ -159,7 +159,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
if( destFile.GetName() == aSrcProjectName )
destFile.SetName( aNewProjectName );
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else
{

View File

@ -417,19 +417,19 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
if( destFile.GetName() == aSrcProjectName )
destFile.SetName( aNewProjectName );
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "brd" )
{
if( destFile.GetName() == aSrcProjectName )
destFile.SetName( aNewProjectName );
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "mod" || ext == "kicad_mod" )
{
// Footprints are not project-specific. Keep their source names.
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( ext == "cmp" )
{
@ -441,7 +441,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
// any non-deterministic cases in the save-as algorithm, we don't want to certify
// the result with the source's DRC report. Therefore copy it under the old
// name.
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
else if( destFile.GetName() == "fp-lib-table" )
{