diff --git a/SystemTools.cxx b/SystemTools.cxx index 396822823d0d830dea1eb6bee17bdd7ebf4a0d65..2e63bb2bc702c9c0964917d194f9c3701d1c7381 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -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);