diff --git a/os/os.v b/os/os.v index c7399d3e65..7ee3553185 100644 --- a/os/os.v +++ b/os/os.v @@ -387,7 +387,7 @@ fn print_c_errno() { } -pub fn get_extension(path string) string { +pub fn ext(path string) string { pos := path.last_index('.') if pos == -1 { return '' @@ -395,6 +395,15 @@ pub fn get_extension(path string) string { return path.right(pos) } +fn path_sans_ext(path string) string { + pos := path.last_index('.') + if pos == -1 { + return path + } + return path.left(pos) +} + + pub fn basedir(path string) string { pos := path.last_index('/') if pos == -1 {