[cmake-commits] hoffman committed SystemTools.cxx 1.157.2.16
1.157.2.17 SystemTools.hxx.in 1.59.2.4 1.59.2.5
SystemTools.hxx.in.bak 1.1.2.1 NONE
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Dec 17 17:41:00 EST 2007
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv5723/Source/kwsys
Modified Files:
Tag: CMake-2-4
SystemTools.cxx SystemTools.hxx.in
Removed Files:
Tag: CMake-2-4
SystemTools.hxx.in.bak
Log Message:
ENH: move changes from main tree
--- SystemTools.hxx.in.bak DELETED ---
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.157.2.16
retrieving revision 1.157.2.17
diff -u -d -r1.157.2.16 -r1.157.2.17
--- SystemTools.cxx 27 Oct 2007 02:57:00 -0000 1.157.2.16
+++ SystemTools.cxx 17 Dec 2007 22:40:58 -0000 1.157.2.17
@@ -64,6 +64,11 @@
# include <windows.h>
#endif
+#ifdef _MSC_VER
+#include <sys/utime.h>
+#else
+#include <utime.h>
+#endif
// This is a hack to prevent warnings about these functions being
// declared but not referenced.
#if defined(__sgi) && !defined(__GNUC__)
@@ -769,6 +774,36 @@
}
}
+bool SystemTools::Touch(const char* filename, bool create)
+{
+ if(create && !SystemTools::FileExists(filename))
+ {
+ FILE* file = fopen(filename, "a+b");
+ if(file)
+ {
+ fclose(file);
+ return true;
+ }
+ return false;
+ }
+#ifdef _MSC_VER
+#define utime _utime
+#define utimbuf _utimbuf
+#endif
+ struct stat fromStat;
+ if(stat(filename, &fromStat) < 0)
+ {
+ return false;
+ }
+ struct utimbuf buf;
+ buf.actime = fromStat.st_atime;
+ buf.modtime = static_cast<time_t>(SystemTools::GetTime());
+ if(utime(filename, &buf) < 0)
+ {
+ return false;
+ }
+ return true;
+}
bool SystemTools::FileTimeCompare(const char* f1, const char* f2,
int* result)
Index: SystemTools.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v
retrieving revision 1.59.2.4
retrieving revision 1.59.2.5
diff -u -d -r1.59.2.4 -r1.59.2.5
--- SystemTools.hxx.in 28 May 2007 14:07:04 -0000 1.59.2.4
+++ SystemTools.hxx.in 17 Dec 2007 22:40:58 -0000 1.59.2.5
@@ -280,6 +280,11 @@
static unsigned long FileLength(const char *filename);
/**
+ Change the modification time or create a file
+ */
+ static bool Touch(const char* filename, bool create);
+
+ /**
* Compare file modification times.
* Return true for successful comparison and false for error.
* When true is returned, result has -1, 0, +1 for
More information about the Cmake-commits
mailing list