diff options
author | 2016-11-17 11:00:49 +0000 | |
---|---|---|
committer | 2016-11-17 18:18:30 +0000 | |
commit | 6c16765a010fccec9e3647e07d0c4b624e25445a (patch) | |
tree | b43799ad3cb60ae3a5ee02462e446799f0749c5e /src/main/cpp/util/file_posix.cc | |
parent | 8a48f616bc1e6df70a30c416268f2c1323ffa9b0 (diff) |
Bazel client: no longer needs <utime.h>
Also remove a lot of unused header files.
The only remaining header file not available on
Windows is <unistd.h>, but cutting that dependency
will be more complicated because we use read/write
and similar I/O functions from it.
--
MOS_MIGRATED_REVID=139439791
Diffstat (limited to 'src/main/cpp/util/file_posix.cc')
-rw-r--r-- | src/main/cpp/util/file_posix.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/cpp/util/file_posix.cc b/src/main/cpp/util/file_posix.cc index 7691ee976a..1cfc272562 100644 --- a/src/main/cpp/util/file_posix.cc +++ b/src/main/cpp/util/file_posix.cc @@ -18,6 +18,8 @@ #include <limits.h> // PATH_MAX #include <stdlib.h> // getenv #include <unistd.h> // access +#include <utime.h> // utime + #include <vector> #include "src/main/cpp/util/errors.h" @@ -87,6 +89,11 @@ time_t GetMtimeMillisec(const string& path) { } } +bool SetMtimeMillisec(const string& path, time_t mtime) { + struct utimbuf times = { mtime, mtime }; + return utime(path.c_str(), ×) == 0; +} + string GetCwd() { char cwdbuf[PATH_MAX]; if (getcwd(cwdbuf, sizeof cwdbuf) == NULL) { |