Bazel client: reduce dependency on POSIX API
We can now compile blaze_util_windows.cc with
MSVC, yay! (when building //src:bazel
--cpu=x64_windows_msvc -k).
There are a lot of #ifdef's and TODOs so this
is a modest victory for now.
In this change:
- change blaze::MakeDirectories to return bool
instead of int, since that's how it was used
anyway, and to expect the permission mask as
unsigned int instead of mode_t, since the
former is good enough and compatible with
mode_t on POSIX while mode_t is not defined on
Windows
- move blaze::MakeDirectories into
blaze_util_<platform>
- implement envvar-handling in
blaze_util_<platform> and use it everywhere
See https://github.com/bazelbuild/bazel/issues/2107
--
MOS_MIGRATED_REVID=139887503
diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc
index fd02628..06f5126 100644
--- a/src/main/cpp/startup_options.cc
+++ b/src/main/cpp/startup_options.cc
@@ -54,9 +54,9 @@
connect_timeout_secs(10),
invocation_policy(NULL),
client_debug(false) {
- bool testing = getenv("TEST_TMPDIR") != NULL;
+ bool testing = !blaze::GetEnv("TEST_TMPDIR").empty();
if (testing) {
- output_root = MakeAbsolute(getenv("TEST_TMPDIR"));
+ output_root = MakeAbsolute(blaze::GetEnv("TEST_TMPDIR"));
} else {
output_root = WorkspaceLayout::GetOutputRoot();
}