model/mpackage: introduce INI path related services
[nit.git] / src / model / mpackage.nit
index d2f15dd..3157233 100644 (file)
@@ -77,6 +77,21 @@ class MPackage
                if path == null then return false
                return not path.has_suffix(".nit")
        end
+
+       # The path to `self` ini file
+       fun ini_path: nullable String do
+               var path = package_path
+               if path == null then return null
+               if is_expanded then return path / "package.ini"
+               return path.dirname / "{name}.ini"
+       end
+
+       # Does `self` have a ini file?
+       fun has_ini: Bool do
+               var ini_path = self.ini_path
+               if ini_path == null then return false
+               return ini_path.file_exists
+       end
 end
 
 # A group of modules in a package