diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-29 15:18:07 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-29 15:18:07 (GMT) |
commit | 1852a88fa1df2017a9a2d1acaf63f91555dd5607 (patch) | |
tree | e2618cac29d5ade44c2af0d349604a83f07b2ab8 /Source/kwsys | |
parent | fdf589d2daff8a6c027585139025085fbd65c041 (diff) | |
download | CMake-1852a88fa1df2017a9a2d1acaf63f91555dd5607.zip CMake-1852a88fa1df2017a9a2d1acaf63f91555dd5607.tar.gz CMake-1852a88fa1df2017a9a2d1acaf63f91555dd5607.tar.bz2 |
ENH: When copy file, if the output file exits, delete it first
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index f860bb5..f909312 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/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); |