aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2021-11-10 15:09:22 +0100
committerGitHub <noreply@github.com>2021-11-10 15:09:22 +0100
commit615efc7c863fc777f80afe1dec41b060bc10c11e (patch)
tree76e4512351635f661abdbe1012fddfcb80410009
parent5cb23725ae64731242e8d425958b0bf4dacf6025 (diff)
parentdd88104a81a7ec9adaf14dc7f21839bbee30cd2d (diff)
Merge pull request #1294 from Kelimion/fix_dir_walk
Fix os.walk for UNC paths.
-rw-r--r--core/os/stat_windows.odin16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/os/stat_windows.odin b/core/os/stat_windows.odin
index 132cad155..2d9f98fd4 100644
--- a/core/os/stat_windows.odin
+++ b/core/os/stat_windows.odin
@@ -115,12 +115,16 @@ cleanpath_strip_prefix :: proc(buf: []u16) -> []u16 {
}
buf = buf[:N]
- if len(buf) >= 4 {
- if buf[0] == '\\' &&
- buf[1] == '\\' &&
- buf[2] == '?' &&
- buf[3] == '\\' {
- buf = buf[4:]
+ if len(buf) >= 4 && buf[0] == '\\' && buf[1] == '\\' && buf[2] == '?' && buf[3] == '\\' {
+ buf = buf[4:]
+
+ /*
+ NOTE(Jeroen): Properly handle UNC paths.
+ We need to turn `\\?\UNC\synology.local` into `\\synology.local`.
+ */
+ if len(buf) >= 3 && buf[0] == 'U' && buf[1] == 'N' && buf[2] == 'C' {
+ buf = buf[2:]
+ buf[0] = '\\'
}
}
return buf