Do a consistent way of searching for a temporary directory.
Do a consistent way of searching for a temporary directory.

The way temporary directories were discovered from
environment variables in different operating systems
was inconsistent.

On Windows, only the system-specific environment variable
TEMP was considered, but not the bazel-common TEST_TMPDIR.
On Unix, only TEST_TMPDIR was considered, but not
the otherwise typical system specific TMPDIR.

Now, always consider TEST_TMPDIR first, followed by the
system-typical environment variable (TEMP on Windows, TMPDIR on Unix)
before falling back to a default on that particular system.

Also: the value for the temporary directory coming from the
environment variable was only checked for a trailing directory
separator on Windows (and appended if needed), not on the other
platforms.
Make this also consistent accross the systems: Now always apply
the same logic to all of these (to accomodate
tests that just concatenate TempDir() without directory separator).
PiperOrigin-RevId: 447909830
Change-Id: I9ea17acdf5944eb2a965615fd9cf142878c33a58

google/googletest,google/googletest,google/googletest,google/googletest