diff --git a/vlib/compiler/modules.v b/vlib/compiler/modules.v index b12a226a37..548aea3040 100644 --- a/vlib/compiler/modules.v +++ b/vlib/compiler/modules.v @@ -160,9 +160,14 @@ fn (v &V) find_module_path(mod string) ?string { mod_path := v.module_path(mod) mut tried_paths := []string tried_paths << filepath.join(v.compiled_dir, mod_path) - tried_paths << filepath.join(os.getwd(), mod_path) - tried_paths << filepath.join(v.pref.vlib_path, mod_path) - tried_paths << filepath.join(v_modules_path, mod_path) + if v.pref.vpath.len > 0 { + tried_paths << filepath.join(v.pref.vlib_path, mod_path) + tried_paths << filepath.join(v.pref.vpath, mod_path) + }else{ + tried_paths << filepath.join(os.getwd(), mod_path) + tried_paths << filepath.join(v.pref.vlib_path, mod_path) + tried_paths << filepath.join(v_modules_path, mod_path) + } for try_path in tried_paths { if v.pref.is_verbose { println(' >> trying to find $mod in $try_path ...') } if os.dir_exists(try_path) {