mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Fix a few bugs in path based code.
Trying to use path.dir and path.rel I found these two issues with the implementation.
This commit is contained in:
@@ -241,7 +241,7 @@ rel :: proc(base_path, target_path: string, allocator := context.allocator) -> (
|
|||||||
for ti < tl && target[ti] != SEPARATOR {
|
for ti < tl && target[ti] != SEPARATOR {
|
||||||
ti += 1;
|
ti += 1;
|
||||||
}
|
}
|
||||||
if !strings.equal_fold(target[t0:ti], base[t0:ti]) {
|
if !strings.equal_fold(target[t0:ti], base[b0:bi]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if bi < bl {
|
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 {
|
dir :: proc(path: string, allocator := context.allocator) -> string {
|
||||||
vol := volume_name(path);
|
vol := volume_name(path);
|
||||||
i := len(path) - 1;
|
i := len(path) - 1;
|
||||||
for i >= len(vol) && is_separator(path[i]) {
|
for i >= len(vol) && !is_separator(path[i]) {
|
||||||
i -= 1;
|
i -= 1;
|
||||||
}
|
}
|
||||||
dir := clean(path[len(vol) : i+1], allocator);
|
dir := clean(path[len(vol) : i+1], allocator);
|
||||||
|
|||||||
Reference in New Issue
Block a user