aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/filesystem/operations.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-11-04 23:51:12 +0200
committerMartin Storsjö <martin@martin.st>2021-02-02 23:03:19 +0200
commit83d705adb2e043e576c9cbaf9709795bc69fe5cf (patch)
tree95cf506d0b4d4cd3b5574ab0caa59efbf2a8992e /libcxx/src/filesystem/operations.cpp
parent0c71c914faa371ba502a2e1835f763104837cb9f (diff)
downloadllvm-83d705adb2e043e576c9cbaf9709795bc69fe5cf.zip
llvm-83d705adb2e043e576c9cbaf9709795bc69fe5cf.tar.gz
llvm-83d705adb2e043e576c9cbaf9709795bc69fe5cf.tar.bz2
[libcxx] Implement the canonical function for windows
Differential Revision: https://reviews.llvm.org/D91170
Diffstat (limited to 'libcxx/src/filesystem/operations.cpp')
-rw-r--r--libcxx/src/filesystem/operations.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 429a585..fc18de9 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -636,20 +636,20 @@ path __canonical(path const& orig_p, error_code* ec) {
ErrorHandler<path> err("canonical", ec, &orig_p, &cwd);
path p = __do_absolute(orig_p, &cwd, ec);
-#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112
- std::unique_ptr<char, decltype(&::free)>
- hold(::realpath(p.c_str(), nullptr), &::free);
+#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112) || defined(_LIBCPP_WIN32API)
+ std::unique_ptr<path::value_type, decltype(&::free)>
+ hold(detail::realpath(p.c_str(), nullptr), &::free);
if (hold.get() == nullptr)
return err.report(capture_errno());
return {hold.get()};
#else
#if defined(__MVS__) && !defined(PATH_MAX)
- char buff[ _XOPEN_PATH_MAX + 1 ];
+ path::value_type buff[ _XOPEN_PATH_MAX + 1 ];
#else
- char buff[PATH_MAX + 1];
+ path::value_type buff[PATH_MAX + 1];
#endif
- char* ret;
- if ((ret = ::realpath(p.c_str(), buff)) == nullptr)
+ path::value_type* ret;
+ if ((ret = detail::realpath(p.c_str(), buff)) == nullptr)
return err.report(capture_errno());
return {ret};
#endif