- # dirpath2 is the root directory
- # dirpath is the src subdirectory directory, if any, else it is the same that dirpath2
- var dirpath2 = dirpath
- if not mp.file_exists then
- if pn == "src" then
- # With a src directory, the group name is the name of the parent directory
- dirpath2 = rdp.dirname
- pn = dirpath2.basename
- else
- # Check a `src` subdirectory
- dirpath = dirpath2 / "src"
- if not dirpath.file_exists then
- # All rules failed, so return null
+ if ini == null then
+ # No ini, multiple course of action
+
+ # The root of the directory hierarchy in the file system.
+ if rdp == "/" then
+ mgroups[rdp] = null
+ return null
+ end
+
+ # Special stopper `projects.ini`
+ if (dirpath/"projects.ini").file_exists then
+ # dirpath cannot be a project since it is a project directory
+ mgroups[rdp] = null
+ return null
+ end
+
+ # check the parent directory (if it does not contain the stopper file)
+ var parentpath = dirpath.join_path("..").simplify_path
+ var stopper = parentpath / "projects.ini"
+ if not stopper.file_exists then
+ # Recursively get the parent group
+ parent = get_mgroup(parentpath)
+ if parent == null then
+ # Parent is not a group, thus we are not a group either
+ mgroups[rdp] = null