This commit is contained in:
yhirose committed 2026-04-12 17:25:41 -04:00
1 parent ee5d15c842
commit 7e2a173072
2 files changed
+12 -1

No files matched your search

+6 -1
View File
@@ -4889,10 +4889,15 @@ inline bool canonicalize_path(const char *path, std::string &resolved) {
char buf[_MAX_PATH];
if (_fullpath(buf, path, _MAX_PATH) == nullptr) { return false; }
resolved = buf;
#else
#elif defined(PATH_MAX)
char buf[PATH_MAX];
if (realpath(path, buf) == nullptr) { return false; }
resolved = buf;
#else
auto buf = realpath(path, nullptr);
auto guard = scope_exit([&]() { std::free(buf); });
if (buf == nullptr) { return false; }
resolved = buf;
#endif
return true;
}