[libcxx-commits] [PATCH] D137131: [libc++][Android] temp dir is /data/local/tmp not /tmp

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 5 15:50:02 PST 2022


rprichard updated this revision to Diff 480266.
rprichard added a comment.

Re-enable the test for Android.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137131/new/

https://reviews.llvm.org/D137131

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


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -136,7 +136,9 @@
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
         TEST_CHECK(!ec);
-#ifndef _WIN32
+#if defined(__ANDROID__)
+        TEST_CHECK(ret == "/data/local/tmp");
+#elif !defined(_WIN32)
         // On Windows, the function falls back to the Windows folder.
         TEST_CHECK(ret == "/tmp");
 #endif
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -1546,12 +1546,16 @@
 #else
   const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
   const char* ret = nullptr;
-
   for (auto& ep : env_paths)
     if ((ret = getenv(ep)))
       break;
-  if (ret == nullptr)
+  if (ret == nullptr) {
+#if defined(__ANDROID__)
+    ret = "/data/local/tmp";
+#else
     ret = "/tmp";
+#endif
+  }
 
   path p(ret);
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137131.480266.patch
Type: text/x-patch
Size: 1317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221205/0a47eb28/attachment-0001.bin>


More information about the libcxx-commits mailing list