aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjockus <joakim.hentula@gmail.com>2021-05-27 12:01:13 +0100
committerjockus <joakim.hentula@gmail.com>2021-05-27 12:01:13 +0100
commite8aa767c8dbb6e52ca4955fd0f67d90cf09507db (patch)
tree59eb458bb435d5e2677339ab0868233fe115a318
parentc85c5ec38cae351ef8394553cdc701cb854656c9 (diff)
Fix deleting substring in filepath.release
-rw-r--r--core/path/filepath/path.odin16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin
index 5ec28c2ec..acb47c4c7 100644
--- a/core/path/filepath/path.odin
+++ b/core/path/filepath/path.odin
@@ -2,6 +2,7 @@
// To process paths usch as URLs that depend on forward slashes regardless of the OS, use the path package
package filepath
+import "core:fmt"
import "core:strings"
// is_separator checks whether the byte is a valid separator character
@@ -206,23 +207,22 @@ Relative_Error :: enum {
rel :: proc(base_path, target_path: string, allocator := context.allocator) -> (string, Relative_Error) {
context.allocator = allocator;
- base_vol, target_vol := volume_name(base_path), volume_name(target_path);
- base, target := clean(base_path), clean(target_path);
+ base_clean, target_clean := clean(base_path), clean(target_path);
delete_target := true;
defer {
if delete_target {
- delete(target);
+ delete(target_clean);
}
- delete(base);
+ delete(base_clean);
}
-
- if strings.equal_fold(target, base) {
+ if strings.equal_fold(target_clean, base_clean) {
return strings.clone("."), .None;
}
- base = base[len(base_vol):];
- target = target[len(target_vol):];
+ base_vol, target_vol := volume_name(base_path), volume_name(target_path);
+ base := base_clean[len(base_vol):];
+ target := target_clean[len(target_vol):];
if base == "." {
base = "";
}