mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-25 05:09:53 +00:00
Merge pull request #6579 from juaumjuaumjuaum/os-stem-empty-fix
Fix os.stem on empty path
This commit is contained in:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user