devctrl.utility.hdf5_backup.find_tld_datafile#
- find_tld_datafile(p: Path, file_pattern: str) Path[source]#
Find the data file associated with the path.
- Parameters:
p – Path to find the main data file for.
file_pattern – Pattern to match filenames with using
re.fullmatch().
- Raises:
FileNotFoundError – If the file was not found.
RuntimeError – If multiple matching files are found in one directory.
- Returns:
Main data file path.
If
pis the file itself, return it.If
pis a directory, check if it contains the file.If
pis a file, check if the data file is in the same directory.Search for the data file in the three directories above the given path.