From 396058c96722b0aac262744af8d4e7a4c8436876 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 13 Nov 2022 13:23:15 -0500 Subject: Trim special parsing prefixes from canonical Windows paths There doesn't seem to be any way to cleanly avoid getting these from GetFinalPathNameByHandle, but I don't think portable code would ever want them introduced. --- src/win32/filesystem_win32.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/win32/filesystem_win32.c b/src/win32/filesystem_win32.c index 3e9b7a6..b37f7bf 100644 --- a/src/win32/filesystem_win32.c +++ b/src/win32/filesystem_win32.c @@ -202,6 +202,11 @@ zix_canonical_path(ZixAllocator* const allocator, const char* const path) return NULL; } + if (final_size > 4U && !strncmp(final, "\\\\?\\", 4)) { + memmove(final, final + 4U, final_size - 4U); + final[final_size - 4U] = '\0'; + } + CloseHandle(h); return final; } -- cgit v1.2.1