var origmmodule = mmodule
var modules = model.get_mmodules_by_name(name)
+ var tries = new Array[String]
+
var lastmodule = mmodule
while mmodule != null do
var dirname = mmodule.location.file.filename.dirname
# Second, try the directory to find a file
var try_file = dirname + "/" + name + ".nit"
+ tries.add try_file
if try_file.file_exists then
var res = self.load_module(owner, try_file.simplify_path)
if res == null then return null # Forward error
var candidate: nullable String = null
for dirname in lookpaths do
var try_file = (dirname + "/" + name + ".nit").simplify_path
+ tries.add try_file
if try_file.file_exists then
if candidate == null then
candidate = try_file
end
if candidate == null then
if origmmodule != null then
- error(anode, "Error: cannot find module {name} from {origmmodule}")
+ error(anode, "Error: cannot find module {name} from {origmmodule}. tried {tries.join(", ")}")
else
- error(anode, "Error: cannot find module {name}")
+ error(anode, "Error: cannot find module {name}. tried {tries.join(", ")}")
end
return null
end