mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rename get_extension to ext, add path_sans_ext
This commit is contained in:
parent
67eb8d74c1
commit
88f67680fc
11
os/os.v
11
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('.')
|
pos := path.last_index('.')
|
||||||
if pos == -1 {
|
if pos == -1 {
|
||||||
return ''
|
return ''
|
||||||
@ -395,6 +395,15 @@ pub fn get_extension(path string) string {
|
|||||||
return path.right(pos)
|
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 {
|
pub fn basedir(path string) string {
|
||||||
pos := path.last_index('/')
|
pos := path.last_index('/')
|
||||||
if pos == -1 {
|
if pos == -1 {
|
||||||
|
Loading…
Reference in New Issue
Block a user