protect_from_overwrite
- glotaran.plugin_system.io_plugin_utils.protect_from_overwrite(path: str | PathLike[str], *, allow_overwrite: bool = False) None [source]
Raise FileExistsError if files already exists and allow_overwrite isn’t True.
As a side effect this also creates the parent directory of a file if it does not exist.
- Parameters:
- Raises:
FileExistsError – If path points to an existing file.
FileExistsError – If path points to an existing folder which is not empty.