aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file_posix.cc
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-12-19 17:47:17 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-12-19 18:56:20 +0000
commit1c9074d6a7a0073066a7d2d0b6da4ad582eabc7b (patch)
treee179d2a33ae98c2b83a144e64bb982337f1f4a3d /src/main/cpp/util/file_posix.cc
parentb9f914fa56a00530d38b597dc853aad50d1decfb (diff)
Bazel client: fix build on Windows
Broken by https://github.com/bazelbuild/bazel/commit/a4d0ea406e8622e305fc3253075cfee60da3d3d2 Reason is that we include both file_posix.cc and file_windows.cc when compiling for MSYS, and I forgot to put the POSIX implementation of SplitPath/IsAbsolute/IsRootDirectory behind `#ifndef __CYGWIN__`. -- PiperOrigin-RevId: 142456232 MOS_MIGRATED_REVID=142456232
Diffstat (limited to 'src/main/cpp/util/file_posix.cc')
-rw-r--r--src/main/cpp/util/file_posix.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/cpp/util/file_posix.cc b/src/main/cpp/util/file_posix.cc
index cb7bd8bd89..b256a68eef 100644
--- a/src/main/cpp/util/file_posix.cc
+++ b/src/main/cpp/util/file_posix.cc
@@ -167,7 +167,6 @@ IPipe* CreatePipe() {
return new PosixPipe(fd[0], fd[1]);
}
-#endif // __CYGWIN__
pair<string, string> SplitPath(const string &path) {
size_t pos = path.rfind('/');
@@ -180,6 +179,7 @@ pair<string, string> SplitPath(const string &path) {
return std::make_pair(string(path, 0, pos), string(path, pos + 1));
}
+#endif // not __CYGWIN__
bool ReadFile(const string &filename, string *content, int max_size) {
int fd = open(filename.c_str(), O_RDONLY);
@@ -272,11 +272,13 @@ bool IsDirectory(const string& path) {
return stat(path.c_str(), &buf) == 0 && S_ISDIR(buf.st_mode);
}
+#ifndef __CYGWIN__
bool IsRootDirectory(const string &path) {
return path.size() == 1 && path[0] == '/';
}
bool IsAbsolute(const string &path) { return !path.empty() && path[0] == '/'; }
+#endif // not __CYGWIN__
void SyncFile(const string& path) {
// fsync always fails on Cygwin with "Permission denied" for some reason.
@@ -292,7 +294,7 @@ void SyncFile(const string& path) {
file_path);
}
close(fd);
-#endif
+#endif // not __CYGWIN__
}
time_t GetMtimeMillisec(const string& path) {