get_or_create_dir#
- tollan.utils.file.get_or_create_dir(dirpath: Path | str, on_exist: Any = None, on_create: Any = None, on_create_context: Any = None) Path[source]#
Ensure
dirpathexist.- Parameters:
dirpath (
pathlib.Path, str) – The path of the directory.on_exist (callable, optional) – If set, called if
dirpathexists already.on_create (callable, optional) – If set, called if
dirpathis created.on_create_context (context, optional) – The context to enter on create.
- Returns:
The created or existing directory path
- Return type:
Path