From c4893f617a9c46d3519422bf8609563294d4f294 Mon Sep 17 00:00:00 2001 From: Shane Shrybman Date: Tue, 7 Apr 2026 11:23:20 -0400 Subject: [PATCH 1/2] Fix typo in filepath.dir description --- core/path/filepath/path.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin index e383e756c..5f46414ae 100644 --- a/core/path/filepath/path.odin +++ b/core/path/filepath/path.odin @@ -245,7 +245,7 @@ rel :: proc(base_path, target_path: string, allocator := context.allocator) -> ( } /* - Returns all but the last element path, usually the path's directory. Once the final element has been removed, + Returns all but the last path element, usually the path's directory. Once the final element has been removed, `dir` calls `clean` on the path and trailing separators are removed. If the path consists purely of separators, then `"."` is returned. */ From 08ae38b9aae2cd0a55ec4dfebc5b4e0b9f165ca4 Mon Sep 17 00:00:00 2001 From: Shane Shrybman Date: Tue, 7 Apr 2026 11:31:33 -0400 Subject: [PATCH 2/2] Fix filepath.dir to return '.' for an empty path --- core/path/filepath/path.odin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/path/filepath/path.odin b/core/path/filepath/path.odin index 5f46414ae..e9f22772c 100644 --- a/core/path/filepath/path.odin +++ b/core/path/filepath/path.odin @@ -246,11 +246,11 @@ rel :: proc(base_path, target_path: string, allocator := context.allocator) -> ( /* Returns all but the last path element, usually the path's directory. Once the final element has been removed, - `dir` calls `clean` on the path and trailing separators are removed. If the path consists purely of separators, - then `"."` is returned. + `dir` calls `clean` on the path and trailing separators are removed. If the path is empty or consists purely + of separators, then `"."` is returned. */ dir :: proc(path: string, allocator := context.allocator) -> string { - i := len(path) - 1 + i := len(path) > 0 ? len(path) - 1 : 0 for i > 0 && !is_separator(path[i]) { i -= 1 }