From aaba7fdb297d8c216033a04b56dfc7ad840486b7 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 30 Sep 2019 23:56:53 +0300 Subject: [PATCH] download vlib if it is missing --- compiler/main.v | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index 6d932d671b..d5a2f4fe62 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -883,9 +883,17 @@ fn new_v(args[]string) &V { //println('VROOT=$vroot') // v.exe's parent directory should contain vlib if !os.dir_exists(vroot) || !os.dir_exists(vroot + '/vlib/builtin') { - println('vlib not found. It should be next to the V executable. ') - println('Go to https://vlang.io to install V.') - exit(1) + println('vlib not found, downloading it...') + ret := os.system('git clone --depth=1 https://github.com/vlang/v .') + if ret != 0 { + println('failed to `git clone` vlib') + println('make sure you are online and have git installed') + exit(1) + } + + //println('vlib not found. It should be next to the V executable. ') + //println('Go to https://vlang.io to install V.') + //exit(1) } //println('out_name:$out_name') mut out_name_c := os.realpath( out_name ) + '.tmp.c'