diff --git a/blueprintcompiler/gir.py b/blueprintcompiler/gir.py index cb73961..e57fe50 100644 --- a/blueprintcompiler/gir.py +++ b/blueprintcompiler/gir.py @@ -25,7 +25,8 @@ from functools import cached_property import gi # type: ignore gi.require_version("GIRepository", "2.0") -from gi.repository import GIRepository # type: ignore +gi.require_version("GLib", "2.0") +from gi.repository import GIRepository, GLib # type: ignore from . import typelib, xml_reader from .errors import CompileError, CompilerBugError @@ -64,11 +65,13 @@ def collect_gir_search_paths(): if _gir_search_paths_initalized: return + base_paths = [ + GLib.get_user_data_dir(), + *GLib.get_system_data_dirs(), + ] + global _gir_search_paths - if data_paths := os.environ.get("XDG_DATA_DIRS"): - _gir_search_paths += [ - os.path.join(path, "gir-1.0") for path in data_paths.split(os.pathsep) - ] + _gir_search_paths = [os.path.join(path, "gir-1.0") for path in base_paths] _gir_search_paths_initalized = True