Skip to content

Commit

Permalink
windows: GetOutputRoot() returns GetHomeDir()
Browse files Browse the repository at this point in the history
This is an immediate fix for a very nasty bug:
#5038

Change-Id: I5e4f9fa13e5ac785514bc0dc4ce6cba9a88f33bb

Closes #5039.

Change-Id: I5e4f9fa13e5ac785514bc0dc4ce6cba9a88f33bb
PiperOrigin-RevId: 193315571
  • Loading branch information
laszlocsomor authored and Copybara-Service committed Apr 18, 2018
1 parent 32d34e9 commit f083e76
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/main/cpp/blaze_util_windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

1 comment on commit f083e76

@Mototrk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f083e76

Please sign in to comment.