[libcxx-commits] [PATCH] D137131: [libc++] Android temp dir is /data/local/tmp, enable Windows test
Ryan Prichard via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 12 20:44:02 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1da06804e1a4: [libc++] Android temp dir is /data/local/tmp, enable Windows test (authored by rprichard).
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
@@ -133,8 +133,16 @@
std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
assert(!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);
+ assert(win_dir_sz > 0 && win_dir_sz < MAX_PATH);
+ assert(win_dir[win_dir_sz-1] != L'\\');
+ assert(ret == win_dir);
+#elif defined(__ANDROID__)
+ assert(ret == "/data/local/tmp");
+#else
assert(ret == "/tmp");
#endif
assert(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.530756.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230613/40873e51/attachment.bin>
More information about the libcxx-commits
mailing list