mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.exe: clone the repo on first launch
This commit is contained in:
parent
0c8afdfe13
commit
688bbcff9c
@ -782,7 +782,15 @@ fn new_v(args[]string) *V {
|
|||||||
println('Setting VROOT to "$lang_dir".')
|
println('Setting VROOT to "$lang_dir".')
|
||||||
os.write_file(TmpPath + '/VROOT', lang_dir)
|
os.write_file(TmpPath + '/VROOT', lang_dir)
|
||||||
} else {
|
} else {
|
||||||
println('Please do it from "v/compiler" directory.')
|
println('V repo not found. Cloning...')
|
||||||
|
os.mv('v', 'v.bin')
|
||||||
|
os.system('git clone https://github.com/vlang/v')
|
||||||
|
if !os.dir_exists('v') {
|
||||||
|
println('failed to clone github.com/vlang/v')
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
os.mv('v.bin', 'v/compiler/v')
|
||||||
|
println('Re-launch V from v/compiler')
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
os/os.v
4
os/os.v
@ -84,6 +84,10 @@ pub fn file_size(path string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mv(old, new string) {
|
||||||
|
C.rename(old.cstr(), new.cstr())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn file_last_mod_unix(path string) int {
|
pub fn file_last_mod_unix(path string) int {
|
||||||
# struct stat attr;
|
# struct stat attr;
|
||||||
# stat(path.str, &attr);
|
# stat(path.str, &attr);
|
||||||
|
Loading…
Reference in New Issue
Block a user