resolve_project_folder#

lumopt2.utils.common.resolve_project_folder(project) str | None#

Return the on-disk project folder for project, creating it if needed.

The canonical location is project.fom.config_map.project_folder, which ConfigMap populates with a (timestamped) name as soon as the FOM is constructed. This helper resolves that path and ensures the directory exists so callers can immediately write logs, plots, or intermediate results into it.

Parameters:
projectProject or duck-typed equivalent

The project whose output folder should be resolved. The function only requires that project.fom.config_map.project_folder is accessible and yields a non-empty string.

Returns:
str or None

Absolute or relative path to an existing directory, or None if project does not expose a usable FOM/config_map. Callers should fall back to a sensible default (e.g. the current working directory) when None is returned.