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

V shell scripts

This commit is contained in:
Alexander Medvednikov
2019-10-15 18:08:46 +03:00
parent 96152510e5
commit 5cd38ec91b
6 changed files with 66 additions and 23 deletions

View File

@ -4,6 +4,8 @@
module os
import strings
#include <sys/stat.h>
#include <signal.h>
#include <errno.h>
@ -864,3 +866,14 @@ pub fn mkdir_all(path string) {
}
}
}
// TODO use []string.join once ...string becomes "[]string"
pub fn join(base string, dirs ...string) string {
mut path := strings.new_builder(50)
path.write(base.trim_right('\\/'))
for d in dirs {
path.write(os.path_separator)
path.write(d)
}
return path.str()
}