loader: print error if bad files given to `scan_full` or `parse_full`
[nit.git] / src / loader.nit
index 0ae8ff0..9b79c62 100644 (file)
@@ -130,6 +130,7 @@ redef class ModelBuilder
                        if stat != null and stat.is_dir then
                                self.toolcontext.info("look in directory {a}", 2)
                                var fs = a.files
+                               alpha_comparator.sort(fs)
                                # Try each entry as a group or a module
                                for f in fs do
                                        var af = a/f
@@ -151,6 +152,11 @@ redef class ModelBuilder
 
                        var mmodule = identify_module(a)
                        if mmodule == null then
+                               if a.file_exists then
+                                       toolcontext.error(null, "Error: `{a}` is not a Nit source file.")
+                               else
+                                       toolcontext.error(null, "Error: cannot find module `{a}`.")
+                               end
                                continue
                        end
 
@@ -539,7 +545,9 @@ redef class ModelBuilder
                var p = mgroup.filepath
                # a virtual group has nothing to scan
                if p == null then return
-               for f in p.files do
+               var files = p.files
+               alpha_comparator.sort(files)
+               for f in files do
                        var fp = p/f
                        var g = identify_group(fp)
                        # Recursively scan for groups of the same package