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

added -user_mod_path command line option to add a module search path

This commit is contained in:
prime31
2019-11-28 02:04:57 -08:00
committed by Alexander Medvednikov
parent 7545ea709a
commit 208f67132d
2 changed files with 8 additions and 0 deletions

View File

@@ -125,6 +125,7 @@ pub mut:
is_fmt bool
is_bare bool
user_mod_path string // `v -user_mod_path /Users/user/modules` adds a new lookup path for imported modules
vlib_path string
vpath string
x64 bool
@@ -851,6 +852,9 @@ pub fn new_v(args[]string) &V {
os.mkdir('$v_modules_path${os.path_separator}cache') or { panic(err) }
}
// optional, custom modules search path
user_mod_path := get_cmdline_option(args, '-user_mod_path', '')
// Location of all vlib files
vroot := os.dir(vexe_path())
vlib_path := get_cmdline_option(args, '-vlib-path', filepath.join(vroot, 'vlib'))
@@ -1039,6 +1043,7 @@ pub fn new_v(args[]string) &V {
building_v: !is_repl && (rdir_name == 'compiler' || rdir_name == 'v.v' || dir.contains('vlib'))
comptime_define: comptime_define
is_fmt: comptime_define == 'vfmt'
user_mod_path: user_mod_path
vlib_path: vlib_path
vpath: vpath
}