contrib & lib: fix other clients of clock
[nit.git] / src / model / mpackage.nit
index c1625ee..8309b5a 100644 (file)
@@ -34,6 +34,8 @@ class MPackage
        # The model of the package
        redef var model: Model
 
+       redef var location
+
        # The root of the group tree
        var root: nullable MGroup = null is writable
 
@@ -66,6 +68,8 @@ class MGroup
        # empty name for a default group in a single-module package
        redef var name: String
 
+       redef var location
+
        # The enclosing package
        var mpackage: MPackage
 
@@ -74,12 +78,15 @@ class MGroup
        var parent: nullable MGroup
 
        # Fully qualified name.
-       # It includes each parent group separated by `/`
+       # It includes each parent group separated by `>`.
+       # The full_name is terminated by `>` to avoid collision with other entities.
+       #
+       # E.g. `core>` and `core>collection>`
        redef fun full_name
        do
                var p = parent
-               if p == null then return name
-               return "{p.full_name}/{name}"
+               if p == null then return "{name}>"
+               return "{p.full_name}{name}>"
        end
 
        # The group is the group tree on the package (`mpackage.mgroups`)
@@ -91,7 +98,14 @@ class MGroup
        fun is_root: Bool do return mpackage.root == self
 
        # The filepath (usually a directory) of the group, if any
-       var filepath: nullable String = null is writable
+       #
+       # safe alias to `location.file.filename`
+       fun filepath: nullable String do
+               var res
+               res = self.location.file
+               if res == null then return null
+               return res.filename
+       end
 
        init
        do