aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file_posix.cc
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-12-21 15:01:36 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-12-21 17:23:51 +0000
commit7de9b6f1d9748d7347fa76f5ac8d0258c79b6d70 (patch)
treee0fc695c7e65e6d0fcd9f2929de6811afdf7e734 /src/main/cpp/util/file_posix.cc
parentfd31061d4cd99277ba1cfacd17ac316f8dfea4f5 (diff)
Bazel client, Windows: implement ReadFile
Implement blaze_util::ReadFile on top of the ::ReadFile Windows API function. Also implement blaze_util::AsWindowsPath so we can convert MSYS paths to Windows widechar paths. Add tests. See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 142659955 MOS_MIGRATED_REVID=142659955
Diffstat (limited to 'src/main/cpp/util/file_posix.cc')
-rw-r--r--src/main/cpp/util/file_posix.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/cpp/util/file_posix.cc b/src/main/cpp/util/file_posix.cc
index c5568a4c3e..127f811d32 100644
--- a/src/main/cpp/util/file_posix.cc
+++ b/src/main/cpp/util/file_posix.cc
@@ -179,7 +179,6 @@ 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);
@@ -190,6 +189,7 @@ bool ReadFile(const string &filename, string *content, int max_size) {
close(fd);
return result;
}
+#endif // not __CYGWIN__
bool WriteFile(const void *data, size_t size, const string &filename) {
UnlinkPath(filename); // We don't care about the success of this.