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:
13
vlib/os/os.v
13
vlib/os/os.v
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user