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

compiler: -o dir/file: create a new directory if it doesn't exist

This commit is contained in:
Alexander Medvednikov 2019-10-30 20:53:30 +03:00
parent e8d34002e1
commit d5cf4d6fd5

View File

@ -840,6 +840,15 @@ pub fn new_v(args[]string) &V {
base := os.getwd().all_after(os.path_separator)
out_name = base.trim_space()
}
// `v -o dir/exec`, create "dir/" if it doesn't exist
if out_name.contains(os.path_separator) {
d := out_name.all_before_last(os.path_separator)
println('DIRRR ' + d)
if !os.dir_exists(d) {
println('creating a new directory "$d"')
os.mkdir(d)
}
}
mut _os := OS.mac
// No OS specifed? Use current system
if target_os == '' {