mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
get extension of path
This commit is contained in:
parent
f0e6a1c1c1
commit
0f05f7c1ee
1 changed files with 9 additions and 0 deletions
9
os/os.v
9
os/os.v
|
@ -386,6 +386,15 @@ fn print_c_errno() {
|
||||||
# printf("errno=%d err='%s'\n", errno, strerror(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 {
|
pub fn basedir(path string) string {
|
||||||
pos := path.last_index('/')
|
pos := path.last_index('/')
|
||||||
if pos == -1 {
|
if pos == -1 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue