Fix bug with realpath() on Windows

This commit is contained in:
Justine Tunney 2024-05-29 18:47:01 -07:00
parent 2816df59b2
commit f31a98d50a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
4 changed files with 57 additions and 3 deletions

View file

@ -20,6 +20,7 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/strace.internal.h"
#include "libc/limits.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
@ -79,3 +80,12 @@ TEST(realpath, test6) {
ASSERT_NE(NULL, name);
EXPECT_STREQ("/", name);
}
TEST(realpath, c_drive) {
if (!IsWindows())
return;
char buf[PATH_MAX];
ASSERT_STREQ("/c", realpath("c:", buf));
ASSERT_STREQ("/c", realpath("c:", buf));
ASSERT_STREQ("/c/Windows", realpath("c:\\Windows", buf));
}