Create a file and all parent directories if they don't exist already.
Parameters:
| Name |
Type |
Description |
Default |
file |
Path
|
|
required
|
Source code in src/library_analyzer/utils/_files.py
| def ensure_file_exists(file: Path) -> None:
"""
Create a file and all parent directories if they don't exist already.
Parameters
----------
file: Path
The file path.
"""
file.parent.mkdir(parents=True, exist_ok=True)
file.touch(exist_ok=True)
|