fixes os.glob not cloning pattern when no meta characters present

This commit is contained in:
Senthilnathan
2026-08-04 12:19:03 +05:30
parent 1d0d31cf4c
commit b838b1bf25
2 changed files with 8 additions and 1 deletions

View File

@@ -746,7 +746,7 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
if !has_meta(pattern) {
// TODO(bill): os.lstat on here to check for error
m := make([]string, 1)
m[0] = pattern
m[0] = strings.clone(pattern)
return m[:], nil
}

View File

@@ -380,6 +380,13 @@ glob_tests := []Glob_Test{
},
err = {},
},
{
pattern = ODIN_ROOT + "tests/core/os/path.odin",
matches = {
ODIN_ROOT + "tests/core/os/path.odin",
},
err = {},
},
}
@(test)