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

unify vexe_path

This commit is contained in:
yuyi
2020-02-20 18:33:01 +08:00
committed by GitHub
parent fcd97f513a
commit d51019dd77
11 changed files with 39 additions and 73 deletions

View File

@@ -30,7 +30,7 @@ fn (v mut V) cc() {
return
}
v.build_thirdparty_obj_files()
vexe := vexe_path()
vexe := pref.vexe_path()
vdir := filepath.dir(vexe)
// Just create a C/JavaScript file and exit
// for example: `v -o v.c compiler`

View File

@@ -733,7 +733,7 @@ pub fn (v &V) get_user_files() []string {
mut user_files := []string
// See cmd/tools/preludes/README.md for more info about what preludes are
vroot := filepath.dir(vexe_path())
vroot := filepath.dir(pref.vexe_path())
preludes_path := filepath.join(vroot,'cmd','tools','preludes')
if v.pref.is_live {
user_files << filepath.join(preludes_path,'live_main.v')
@@ -844,16 +844,6 @@ pub fn (v &V) log(s string) {
println(s)
}
pub fn vexe_path() string {
vexe := os.getenv('VEXE')
if '' != vexe {
return vexe
}
real_vexe_path := os.realpath(os.executable())
os.setenv('VEXE', real_vexe_path, true)
return real_vexe_path
}
pub fn verror(s string) {
println('V error: $s')
os.flush_stdout()

View File

@@ -28,7 +28,7 @@ mut:
// `mod` == "vlib/os"
fn generate_vh(mod string) {
println('\n\n\n\nGenerating a V header file for module `$mod`')
vexe := vexe_path()
vexe := pref.vexe_path()
full_mod_path := filepath.join(filepath.dir(vexe),mod)
dir := if mod.starts_with('vlib') { '$compiler.v_modules_path${filepath.separator}$mod' } else { mod }
path := dir + '.vh'