summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-11-13 13:23:15 -0500
committerDavid Robillard <d@drobilla.net>2022-11-13 15:15:51 -0500
commit396058c96722b0aac262744af8d4e7a4c8436876 (patch)
tree3b0f1194126fe71e4984ffb16ff31038067ba248
parent68c1cdeb51bcac4e6d55e450b955a197cd6d0b42 (diff)
downloadzix-396058c96722b0aac262744af8d4e7a4c8436876.tar.gz
zix-396058c96722b0aac262744af8d4e7a4c8436876.tar.bz2
zix-396058c96722b0aac262744af8d4e7a4c8436876.zip
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.
-rw-r--r--src/win32/filesystem_win32.c5
1 files changed, 5 insertions, 0 deletions
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;
}