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

v.util: change naming behaviour for modules relative to working dir. closes #9138

This commit is contained in:
Joe Conigliaro 2021-03-10 16:28:06 +11:00
parent 96a9e16e64
commit fd2845e955
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1

View File

@ -36,6 +36,11 @@ pub fn qualify_module(mod string, file_path string) string {
return mod return mod
} }
clean_file_path := file_path.all_before_last('/') clean_file_path := file_path.all_before_last('/')
// relative module (relative to working directory)
// TODO: find most stable solution & test with -usecache
if clean_file_path.replace(os.getwd() + os.path_separator, '') == mod {
return mod
}
if m1 := mod_path_to_full_name(mod, clean_file_path) { if m1 := mod_path_to_full_name(mod, clean_file_path) {
$if trace_mod_path_to_full_name ? { $if trace_mod_path_to_full_name ? {
trace_mod_path_to_full_name(@LINE, mod, clean_file_path, m1) trace_mod_path_to_full_name(@LINE, mod, clean_file_path, m1)