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:

committed by
Alexander Medvednikov

parent
0fb0c43c0a
commit
3a6ccf7f31
@ -108,7 +108,7 @@ fn (v mut V) cc() {
|
||||
}
|
||||
if v.pref.ccompiler == 'cc' && os.file_exists(tcc_path) {
|
||||
// TODO tcc bug, needs an empty libtcc1.a fila
|
||||
//os.mkdir('/var/tmp/tcc/lib/tcc/')
|
||||
//os.mkdir('/var/tmp/tcc/lib/tcc/') or { panic(err) }
|
||||
//os.create('/var/tmp/tcc/lib/tcc/libtcc1.a')
|
||||
v.pref.ccompiler = tcc_path
|
||||
a << '-m64'
|
||||
|
@ -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
|
||||
|
@ -36,7 +36,7 @@ fn generate_vh(mod string) {
|
||||
pdir := dir.all_before_last(os.path_separator)
|
||||
if !os.dir_exists(pdir) {
|
||||
os.mkdir_all(pdir)
|
||||
// os.mkdir(os.realpath(dir))
|
||||
// os.mkdir(os.realpath(dir)) or { panic(err) }
|
||||
}
|
||||
out := os.create(path) or { panic(err) }
|
||||
mod_path := mod.replace("\\", "/")
|
||||
@ -169,5 +169,3 @@ fn (g mut VhGen) generate_type() {
|
||||
//g.i = old
|
||||
//g.i--
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ import filepath
|
||||
pub fn get_vtmp_folder() string {
|
||||
vtmp := filepath.join(os.tmpdir(),'v')
|
||||
if !os.dir_exists( vtmp ) {
|
||||
os.mkdir(vtmp)
|
||||
os.mkdir(vtmp) or { panic(err) }
|
||||
}
|
||||
return vtmp
|
||||
}
|
||||
|
Reference in New Issue
Block a user