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

util/module: fix mod_path_to_full_name() (#11329)

This commit is contained in:
yuyi 2021-08-29 16:56:05 +08:00 committed by GitHub
parent 8be2be8311
commit 4ce9ad6a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ pub fn mod_path_to_full_name(pref &pref.Preferences, mod string, path string) ?s
path_parts := path.split(os.path_separator) path_parts := path.split(os.path_separator)
mod_path := mod.replace('.', os.path_separator) mod_path := mod.replace('.', os.path_separator)
// go back through each parent in path_parts and join with `mod_path` to see the dir exists // go back through each parent in path_parts and join with `mod_path` to see the dir exists
for i := path_parts.len - 1; i >= 0; i-- { for i := path_parts.len - 1; i > 0; i-- {
try_path := os.join_path(path_parts[0..i].join(os.path_separator), mod_path) try_path := os.join_path(path_parts[0..i].join(os.path_separator), mod_path)
// found module path // found module path
if os.is_dir(try_path) { if os.is_dir(try_path) {