From 5794594e19ff5019c1cd13d79bcff4d7ce228820 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 24 Nov 2019 18:39:30 +0200 Subject: [PATCH] compiler: fix vpath module search order regression --- vlib/compiler/modules.v | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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) {