aboutsummaryrefslogtreecommitdiff
path: root/core/path/filepath
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2020-10-24 01:28:15 +0100
committerGitHub <noreply@github.com>2020-10-24 01:28:15 +0100
commit6ea000b648d3900fd6de6434a29ae51b81e953cb (patch)
tree143cdb041033ae005b5d17ff3dc5a169bb427b2e /core/path/filepath
parentfeeb342c009022b3de6f903ef1e3cc40b54951ca (diff)
parent062ae56f255a0ea61bc9ac2596b8bcb618fa66f1 (diff)
Merge pull request #752 from powerc9000/patch-4
Fix a few bugs in path based code.
Diffstat (limited to 'core/path/filepath')
-rw-r--r--core/path/filepath/path.odin4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin
index 2142a674c..3a11c09e8 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);