Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: File was only closed lazily by garbage collector
Problem: Reading a file using `f.open().read()` keeps the file open until the garbage collector deletes the variable. Since this uses Pathlib already, using `Path(...).read_text()` is cleaner and does not depend on the opening mode being `r`. A file with no content could not be distinguished from a missing file. Instead, this changes the behaviour to return None when the file is missing instead of an empty string.
- Loading branch information