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

os: mkdir() error handling

This commit is contained in:
Don Alfons Nisnoni
2019-11-24 00:55:18 +08:00
committed by Alexander Medvednikov
parent 0fb0c43c0a
commit 3a6ccf7f31
12 changed files with 32 additions and 32 deletions

View File

@ -843,8 +843,8 @@ pub fn (v &V) log(s string) {
pub fn new_v(args[]string) &V {
// Create modules dirs if they are missing
if !os.dir_exists(v_modules_path) {
os.mkdir(v_modules_path)
os.mkdir('$v_modules_path${os.path_separator}cache')
os.mkdir(v_modules_path) or { panic(err) }
os.mkdir('$v_modules_path${os.path_separator}cache') or { panic(err) }
}
// Location of all vlib files
@ -903,7 +903,7 @@ pub fn new_v(args[]string) &V {
// Cross compiling? Use separate dirs for each os
/*
if target_os != os.user_os() {
os.mkdir('$TmpPath/vlib/$target_os')
os.mkdir('$TmpPath/vlib/$target_os') or { panic(err) }
out_name = '$TmpPath/vlib/$target_os/${base}.o'
println('target_os=$target_os user_os=${os.user_os()}')
println('!Cross compiling $out_name')
@ -939,7 +939,7 @@ pub fn new_v(args[]string) &V {
d := out_name.all_before_last(os.path_separator)
if !os.dir_exists(d) {
println('creating a new directory "$d"')
os.mkdir(d)
os.mkdir(d) or { panic(err) }
}
}
mut _os := OS.mac