[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 16:30:02 PST 2022
rprichard updated this revision to Diff 480278.
rprichard added a comment.
Enable the test for Windows.
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,8 +136,16 @@
std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
-#ifndef _WIN32
+#if defined(_WIN32)
// On Windows, the function falls back to the Windows folder.
+ wchar_t win_dir[MAX_PATH];
+ DWORD win_dir_sz = GetWindowsDirectoryW(win_dir, MAX_PATH);
+ TEST_CHECK(win_dir_sz > 0 && win_dir_sz < MAX_PATH);
+ TEST_CHECK(win_dir[win_dir_sz-1] != L'\\');
+ TEST_CHECK(ret == win_dir);
+#elif defined(__ANDROID__)
+ TEST_CHECK(ret == "/data/local/tmp");
+#else
TEST_CHECK(ret == "/tmp");
#endif
TEST_CHECK(is_directory(ret));
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -1550,8 +1550,13 @@
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.480278.patch
Type: text/x-patch
Size: 1514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221206/773f2a42/attachment.bin>
More information about the libcxx-commits
mailing list