compiler: fix vpath module search order regression

pull/2875/head
Delyan Angelov 2019-11-24 18:39:30 +02:00 committed by Alexander Medvednikov
parent f496c1b27b
commit 5794594e19
1 changed files with 8 additions and 3 deletions

View File

@ -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) {