rename get_extension to ext, add path_sans_ext

pull/1049/head
Kaiyin Zhong 2019-06-26 12:56:05 +02:00 committed by Alex Medvednikov
parent 67eb8d74c1
commit 88f67680fc
1 changed files with 10 additions and 1 deletions

11
os/os.v
View File

@ -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 {