1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

get extension of path

This commit is contained in:
Kaiyin Zhong 2019-06-26 11:28:06 +02:00 committed by Alex Medvednikov
parent f0e6a1c1c1
commit 0f05f7c1ee

View File

@ -386,6 +386,15 @@ fn print_c_errno() {
# printf("errno=%d err='%s'\n", errno, strerror(errno));
}
pub fn get_extension(path string) string {
pos := path.last_index('.')
if pos == -1 {
return ''
}
return path.right(pos)
}
pub fn basedir(path string) string {
pos := path.last_index('/')
if pos == -1 {