From f4aa97f89a07f4448a992bb0c3644a7ff0a65679 Mon Sep 17 00:00:00 2001 From: Shane Shrybman Date: Thu, 9 Apr 2026 23:26:37 -0400 Subject: [PATCH] Fix os._volume_name_len to handle paths of purely separators. Also, fix '\h\s' handling --- core/os/stat_windows.odin | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/os/stat_windows.odin b/core/os/stat_windows.odin index 51bd57d5b..35f2ae86b 100644 --- a/core/os/stat_windows.odin +++ b/core/os/stat_windows.odin @@ -377,17 +377,25 @@ _volume_name_len :: proc(path: string) -> (length: int) { // UNC path, minimum version of the volume is `\\h\s` for host, share. // Can also contain an IP address in the host position. + // (path might be purely path separators) slash_count := 0 + found_host: bool for i in prefix.. 0 { + if _is_path_separator(path[i]) { slash_count += 1 - if slash_count == 2 { + if slash_count == 2 && found_host { return i } + } else { + found_host = true + // Found a host but no trailing slash `\\h\s` + if slash_count == 1 && i == len(path)-1 { + return len(path) + } } } - return len(path) + return 0 } \ No newline at end of file