Merge pull request #6579 from juaumjuaumjuaum/os-stem-empty-fix

Fix os.stem on empty path
This commit is contained in:
Jeroen van Rijn
2026-04-16 15:37:02 +02:00
committed by GitHub

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 ""