From: Jean Privat Date: Mon, 24 Aug 2015 19:55:11 +0000 (-0400) Subject: loader: get_mgroup check and assign the `project.ini` file to projects X-Git-Tag: v0.7.8~69^2~6 X-Git-Url: http://nitlanguage.org loader: get_mgroup check and assign the `project.ini` file to projects Signed-off-by: Jean Privat --- diff --git a/src/loader.nit b/src/loader.nit index 2516f3a..90c439f 100644 --- a/src/loader.nit +++ b/src/loader.nit @@ -402,6 +402,14 @@ redef class ModelBuilder var pn = rdp.basename(".nit") var mp = dirpath.join_path(pn + ".nit").simplify_path + # Check `project.ini` that indicate a project + var ini = null + var parent = null + var inipath = dirpath / "project.ini" + if inipath.file_exists then + ini = new ConfigTree(inipath) + end + # dirpath2 is the root directory # dirpath is the src subdirectory directory, if any, else it is the same that dirpath2 var dirpath2 = dirpath @@ -427,10 +435,12 @@ redef class ModelBuilder var mgroup if parent == null then # no parent, thus new project + if ini != null and ini.has_key("name") then pn = ini["name"] var mproject = new MProject(pn, model) mgroup = new MGroup(pn, mproject, null) # same name for the root group mproject.root = mgroup toolcontext.info("found project `{mproject}` at {dirpath}", 2) + mproject.ini = ini else mgroup = new MGroup(pn, parent.mproject, parent) toolcontext.info("found sub group `{mgroup.full_name}` at {dirpath}", 2)