ENH: When copy file, if the output file exits, delete it first

This commit is contained in:
Andy Cedilnik 2004-09-29 11:18:07 -04:00
parent fdf589d2da
commit 1852a88fa1
1 changed files with 5 additions and 0 deletions

View File

@ -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);