Commit ec8aafcb authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

[mini_installer] Fix reporting of temp dir fallback metrics.

r798844 introduced a metric to report whether or not the work directory
was created in CWD or %TMP%. Sadly, the metric unconditionally reported
that the fallback was never used.

BUG=516207,1100280
R=wfh@chromium.org

Change-Id: I64140cac44dde7baf029e03c31e460a91fa177b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2508611
Commit-Queue: Greg Thompson <grt@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822538}
parent c5ae0723
......@@ -744,7 +744,8 @@ bool CreateWorkDir(const wchar_t* base_path,
// Creates and returns a temporary directory in |work_dir| that can be used to
// extract mini_installer payload. |work_dir| ends with a path separator.
// |used_fallback| is set to true if the %TMP% directory was used rather than
// the directory containing |module|.
// the directory containing |module|. Returns true if |work_dir| is available
// for use, or false in case of error (indicated by |exit_code|).
bool GetWorkDir(HMODULE module,
PathString* work_dir,
bool* used_fallback,
......@@ -758,8 +759,13 @@ bool GetWorkDir(HMODULE module,
}
// Failing that, try to create one in the TMP directory.
return GetTempDir(&base_path, exit_code) &&
CreateWorkDir(base_path.get(), work_dir, exit_code);
if (GetTempDir(&base_path, exit_code) &&
CreateWorkDir(base_path.get(), work_dir, exit_code)) {
*used_fallback = true;
return true;
}
return false;
}
ProcessExitResult WMain(HMODULE module) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment