diff options
| author | Clay Murray <clay.murray8@gmail.com> | 2020-10-07 16:32:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-07 16:32:00 -0600 |
| commit | 062ae56f255a0ea61bc9ac2596b8bcb618fa66f1 (patch) | |
| tree | f569e9ac32d31e9908a96cb559db5bd08e823209 /core | |
| parent | 6eeb12a986318665b008ac107b039772b5eb2eb8 (diff) | |
Fix a few bugs in path based code.
Trying to use path.dir and path.rel I found these two issues with the implementation.
Diffstat (limited to 'core')
| -rw-r--r-- | core/path/filepath/path.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin index 283eb3a9e..f1e20279b 100644 --- a/core/path/filepath/path.odin +++ b/core/path/filepath/path.odin @@ -241,7 +241,7 @@ rel :: proc(base_path, target_path: string, allocator := context.allocator) -> ( for ti < tl && target[ti] != SEPARATOR { ti += 1; } - if !strings.equal_fold(target[t0:ti], base[t0:ti]) { + if !strings.equal_fold(target[t0:ti], base[b0:bi]) { break; } if bi < bl { @@ -284,7 +284,7 @@ rel :: proc(base_path, target_path: string, allocator := context.allocator) -> ( dir :: proc(path: string, allocator := context.allocator) -> string { vol := volume_name(path); i := len(path) - 1; - for i >= len(vol) && is_separator(path[i]) { + for i >= len(vol) && !is_separator(path[i]) { i -= 1; } dir := clean(path[len(vol) : i+1], allocator); |