- var try_file = (dirname + "/" + name + ".nit").simplify_path
- if try_file.file_exists then
- if candidate == null then
- candidate = try_file
- else if candidate != try_file then
- # try to disambiguate conflicting modules
- var abs_candidate = module_absolute_path(candidate)
- var abs_try_file = module_absolute_path(try_file)
- if abs_candidate != abs_try_file then
- toolcontext.error(location, "Error: conflicting module file for `{name}`: `{candidate}` `{try_file}`")
- end
- end
- end
- try_file = (dirname + "/" + name + "/" + name + ".nit").simplify_path
- if try_file.file_exists then
- if candidate == null then
- candidate = try_file
- else if candidate != try_file then
- # try to disambiguate conflicting modules
- var abs_candidate = module_absolute_path(candidate)
- var abs_try_file = module_absolute_path(try_file)
- if abs_candidate != abs_try_file then
- toolcontext.error(location, "Error: conflicting module file for `{name}`: `{candidate}` `{try_file}`")
- end
- end
- end
- try_file = (dirname + "/" + name + "/src/" + name + ".nit").simplify_path
- if try_file.file_exists then
- if candidate == null then
- candidate = try_file
- else if candidate != try_file then
- # try to disambiguate conflicting modules
- var abs_candidate = module_absolute_path(candidate)
- var abs_try_file = module_absolute_path(try_file)
- if abs_candidate != abs_try_file then
- toolcontext.error(location, "Error: conflicting module file for `{name}`: `{candidate}` `{try_file}`")
- end
- end
+ # Try a single module file
+ var mp = identify_file((dirname/"{name}.nit").simplify_path)
+ if mp != null then res.add mp
+ # Try the default module of a group
+ var g = get_mgroup((dirname/name).simplify_path)
+ if g != null then
+ scan_group(g)
+ res.add_all g.mmodule_paths_by_name(name)