v.util: fix bug of mod_path_to_full_name (#8236)

pull/8244/head
zakuro 2021-01-21 20:24:32 +09:00 committed by GitHub
parent 4045ec1ca8
commit f413c92f2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -90,18 +90,17 @@ pub fn mod_path_to_full_name(mod string, path string) ?string {
if ls := os.ls(parent) { if ls := os.ls(parent) {
// currently CI clones some modules into the v repo to test, the condition // currently CI clones some modules into the v repo to test, the condition
// after `'v.mod' in ls` can be removed once a proper solution is added // after `'v.mod' in ls` can be removed once a proper solution is added
if try_path_parts.len <= i { if 'v.mod' in ls &&
continue (try_path_parts.len > i && try_path_parts[i] != 'v' && 'vlib' !in ls)
} {
if 'v.mod' in ls && try_path_parts[i] != 'v' && 'vlib' !in ls {
last_v_mod = j last_v_mod = j
continue
} }
continue
} }
break break
} }
if last_v_mod > -1 { if last_v_mod > -1 {
mod_full_name := try_path_parts[last_v_mod - 1..].join('.') mod_full_name := try_path_parts[last_v_mod..].join('.')
return mod_full_name return mod_full_name
} }
} }