diff options
author | Brad King <brad.king@kitware.com> | 2015-04-10 15:07:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-10 16:51:10 (GMT) |
commit | 5c08e2559cf8ad5fc3cb220396016cf816a7b4b8 (patch) | |
tree | 4c160febd2ffa264e077de72f8e1528384c4c05b | |
parent | 732d8a467ab8a295b1bbf580f865980f8a1a9b29 (diff) | |
download | CMake-5c08e2559cf8ad5fc3cb220396016cf816a7b4b8.zip CMake-5c08e2559cf8ad5fc3cb220396016cf816a7b4b8.tar.gz CMake-5c08e2559cf8ad5fc3cb220396016cf816a7b4b8.tar.bz2 |
KWSys SystemTools: Teach Touch with !create to succeed on missing file
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b03e7b0..b9b65a0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1215,15 +1215,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path) bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) { - if(create && !SystemTools::FileExists(filename)) + if (!SystemTools::FileExists(filename)) { - FILE* file = Fopen(filename, "a+b"); - if(file) + if(create) + { + FILE* file = Fopen(filename, "a+b"); + if(file) + { + fclose(file); + return true; + } + return false; + } + else { - fclose(file); return true; } - return false; } #if defined(_WIN32) && !defined(__CYGWIN__) HANDLE h = CreateFileW( |