mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-25 07:58:59 -06:00
ENH: When copy file, if the output file exits, delete it first
This commit is contained in:
@@ -967,6 +967,11 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( SystemTools::FileExists(destination) && !SystemTools::RemoveFile(destination) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
kwsys_ios::ofstream fout(destination,
|
||||
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
|
||||
|
||||
Reference in New Issue
Block a user