[all-commits] [llvm/llvm-project] 1da068: [libc++] Android temp dir is /data/local/tmp, enab...

Ryan Prichard via All-commits all-commits at lists.llvm.org
Mon Jun 12 20:44:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1da06804e1a405e5399a1a19ae791a40f77dfbab
      https://github.com/llvm/llvm-project/commit/1da06804e1a405e5399a1a19ae791a40f77dfbab
  Author: Ryan Prichard <rprichard at google.com>
  Date:   2023-06-12 (Mon, 12 Jun 2023)

  Changed paths:
    M libcxx/src/filesystem/operations.cpp
    M libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp

  Log Message:
  -----------
  [libc++] Android temp dir is /data/local/tmp, enable Windows test

[libc++] Android temp dir is /data/local/tmp, enable Windows test

On Android, std::filesystem::temp_directory_path() should fall back to
/data/local/tmp when no environment variable is set. There is no /tmp
directory. Most apps can't access /data/local/tmp, but they do have a
"cache dir" (Context#getCacheDir()) that is usable for temporary files.
However, there is no obvious and reliable way for libc++ to query this
directory in contexts where it is available. The global fallback
/data/local/tmp is available for "adb shell", making it useful for test
suites.

On Windows, temp_directory_path falls back to the Windows directory
(e.g. "C:\Windows"), so call GetWindowsDirectoryW to do the test.

Reviewed By: ldionne, #libc, enh

Differential Revision: https://reviews.llvm.org/D137131




More information about the All-commits mailing list