This commit is contained in:
Jeroen van Rijn
2026-02-12 10:48:26 +01:00
parent b18f75c41c
commit 97683ae014
2 changed files with 5 additions and 6 deletions

View File

@@ -145,7 +145,7 @@ This will remove duplicate separators and unneeded references to the current or
parent directory.
*/
@(require_results)
clean_path :: proc(path: string, allocator: runtime.Allocator) -> (cleaned: string, err: Error) {
clean_path :: proc(path: string, allocator: runtime.Allocator) -> (cleaned: string, err: runtime.Allocator_Error) {
if path == "" || path == "." {
return strings.clone(".", allocator)
}
@@ -491,7 +491,7 @@ Join all `elems` with the system's path separator and normalize the result.
For example, `join_path({"/home", "foo", "bar.txt"})` will result in `"/home/foo/bar.txt"`.
*/
@(require_results)
join_path :: proc(elems: []string, allocator: runtime.Allocator) -> (joined: string, err: Error) {
join_path :: proc(elems: []string, allocator: runtime.Allocator) -> (joined: string, err: runtime.Allocator_Error) {
for e, i in elems {
if e != "" {
temp_allocator := TEMP_ALLOCATOR_GUARD({ allocator })

View File

@@ -5,10 +5,9 @@ import "core:testing"
@(test)
test_clone :: proc(t: ^testing.T) {
joined, err := os.join_path({#directory, "file.odin"}, context.temp_allocator)
testing.expect_value(t, err, nil)
f: ^os.File
f, err = os.open(joined)
joined, j_err := os.join_path({#directory, "file.odin"}, context.temp_allocator)
testing.expect_value(t, j_err, nil)
f, err := os.open(joined)
testing.expect_value(t, err, nil)
testing.expect(t, f != nil)