Fix os.stem on empty path

This commit is contained in:
juaum
2026-04-16 15:11:40 +02:00
parent 813e2bd807
commit 7e4240a460

View File

@@ -413,10 +413,15 @@ e.g.
'name.tar.gz' -> 'name.tar'
'name.txt' -> 'name'
Returns an empty string if the path is empty
Returns an empty string if there is no stem. e.g: '.gitignore'.
Returns an empty string if there's a trailing path separator.
*/
stem :: proc(path: string) -> string {
if path == "" {
return ""
}
// If the last character is a path separator, there is no file.
if is_path_separator(path[len(path) - 1]) {
return ""