aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/blaze_util_windows.cc
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2018-04-18 00:38:57 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-18 00:40:37 -0700
commitf083e7623cd03e20ed216117c5ea8c8b4ec61948 (patch)
tree15c3ade54337b3c8a8ebf3c57ca072c3e2aa78c4 /src/main/cpp/blaze_util_windows.cc
parent32d34e906b0c5e9b80a97683dc4795d869561ab4 (diff)
windows: GetOutputRoot() returns GetHomeDir()
This is an immediate fix for a very nasty bug: https://github.com/bazelbuild/bazel/issues/5038 Change-Id: I5e4f9fa13e5ac785514bc0dc4ce6cba9a88f33bb Closes #5039. Change-Id: I5e4f9fa13e5ac785514bc0dc4ce6cba9a88f33bb PiperOrigin-RevId: 193315571
Diffstat (limited to 'src/main/cpp/blaze_util_windows.cc')
-rw-r--r--src/main/cpp/blaze_util_windows.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/main/cpp/blaze_util_windows.cc b/src/main/cpp/blaze_util_windows.cc
index 418155c1c7..924ceb0fe9 100644
--- a/src/main/cpp/blaze_util_windows.cc
+++ b/src/main/cpp/blaze_util_windows.cc
@@ -202,19 +202,12 @@ string GetSelfPath() {
}
string GetOutputRoot() {
- for (const char* i : {"TMPDIR", "TEMPDIR", "TMP", "TEMP"}) {
- string tmpdir(GetEnv(i));
- if (!tmpdir.empty()) {
- return tmpdir;
- }
- }
-
- WCHAR buffer[kWindowsPathBufferSize] = {0};
- if (!::GetTempPathW(kWindowsPathBufferSize, buffer)) {
+ string home = GetHomeDir();
+ if (home.empty()) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
- << "GetOutputRoot: GetTempPathW: " << GetLastErrorString();
+ << "Cannot find a good output root. Use the --output_user_root flag.";
}
- return string(blaze_util::WstringToCstring(buffer).get());
+ return home;
}
string GetHomeDir() {