diff options
| author | gingerBill <bill@gingerbill.org> | 2021-09-19 11:59:31 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-09-19 11:59:31 +0100 |
| commit | ceebd7b23cb8efb6c1c1c56275c780439b2c4764 (patch) | |
| tree | 974021b0538d57671e2c5322731c5b2f1914eae0 /core/path | |
| parent | 2b77f5b72f26d1453d8e4b3362d716ebd46b70a3 (diff) | |
Correct `context.allocator` usage
Diffstat (limited to 'core/path')
| -rw-r--r-- | core/path/filepath/path_windows.odin | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/path/filepath/path_windows.odin b/core/path/filepath/path_windows.odin index db8fb547c..25b2ae500 100644 --- a/core/path/filepath/path_windows.odin +++ b/core/path/filepath/path_windows.odin @@ -91,13 +91,15 @@ abs :: proc(path: string, allocator := context.allocator) -> (string, bool) { join :: proc(elems: ..string, allocator := context.allocator) -> string { for e, i in elems { if e != "" { - return join_non_empty(elems[i:]) + return join_non_empty(elems[i:], allocator) } } return "" } -join_non_empty :: proc(elems: []string) -> string { +join_non_empty :: proc(elems: []string, allocator := context.allocator) -> string { + context.allocator = allocator + if len(elems[0]) == 2 && elems[0][1] == ':' { i := 1 for ; i < len(elems); i += 1 { @@ -110,8 +112,7 @@ join_non_empty :: proc(elems: []string) -> string { return clean(s) } - s := strings.join(elems, SEPARATOR_STRING, context.temp_allocator) - p := clean(s) + p := clean(strings.join(elems, SEPARATOR_STRING, context.temp_allocator)) if !is_UNC(p) { return p } |