[docs]defresolve_fermilink_home()->Path:"""Resolve global FermiLink home root and ensure it exists. Defaults to ``~/.fermilink`` when ``FERMILINK_HOME`` is unset. """root=_resolve_path(os.getenv("FERMILINK_HOME"),default=Path.home()/".fermilink",)root.mkdir(parents=True,exist_ok=True)returnroot
[docs]defresolve_scipkg_root()->Path:"""Resolve scientific-package storage root and ensure it exists."""raw=_first_env("FERMILINK_SCIPKG_ROOT","FERMILINK_SCIENTIFIC_PACKAGES_ROOT",)ifraw:root=_resolve_path(raw,default=Path.cwd())else:root=resolve_fermilink_home()/"scientific_packages"root.mkdir(parents=True,exist_ok=True)returnroot
[docs]defresolve_workspaces_root()->Path:"""Resolve workspaces root and ensure it exists."""raw=os.getenv("FERMILINK_WORKSPACES_ROOT")ifrawandraw.strip():root=_resolve_path(raw,default=Path.cwd())else:root=resolve_fermilink_home()/"workspaces"root.mkdir(parents=True,exist_ok=True)returnroot
[docs]defresolve_runtime_root()->Path:"""Resolve runtime state root for daemonized services."""raw=os.getenv("FERMILINK_RUNTIME_ROOT")ifrawandraw.strip():root=_resolve_path(raw,default=Path.cwd())else:root=resolve_fermilink_home()/"runtime"root.mkdir(parents=True,exist_ok=True)returnroot