loader: get_mgroup search README in src first then in the root directory
authorJean Privat <jean@pryen.org>
Mon, 30 Mar 2015 04:41:38 +0000 (11:41 +0700)
committerJean Privat <jean@pryen.org>
Wed, 1 Apr 2015 08:44:46 +0000 (15:44 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit

index 60ed8e8..818f049 100644 (file)
@@ -421,13 +421,19 @@ redef class ModelBuilder
                        mgroup = new MGroup(pn, parent.mproject, parent)
                        toolcontext.info("found sub group `{mgroup.full_name}` at {dirpath}", 2)
                end
-               var readme = dirpath2.join_path("README.md")
+
+               # search documentation
+               # in src first so the documentation of the project code can be distinct for the documentation of the project usage
+               var readme = dirpath.join_path("README.md")
+               if not readme.file_exists then readme = dirpath.join_path("README")
+               if not readme.file_exists then readme = dirpath2.join_path("README.md")
                if not readme.file_exists then readme = dirpath2.join_path("README")
                if readme.file_exists then
                        var mdoc = load_markdown(readme)
                        mgroup.mdoc = mdoc
                        mdoc.original_mentity = mgroup
                end
+
                mgroup.filepath = dirpath
                mgroups[rdp] = mgroup
                return mgroup