file module
- pdbstore.io.file.build_files_list(files: str | List[str], recursive: bool = False, exist_only: bool = False) List[Path]
Build list of required files given input file given by end-user
This function analyzes
filesto build the list of required files, so:recursive exploration if an entry is a directory
parse reponse file if an entry is formatted with
@namelogicuse the input file as it is if a file exists
- Parameters:
files – It can be a simple or a list of path
recursive – True to explore recursively the specified directories, else False
exist_only – True to retrieve the list of existing files, else False
- Returns:
List of Path object
- pdbstore.io.file.compute_hash_key(file_path: str | Path) str | None
Compute hash key given a file path
- Returns:
The computed hash key if successful, else None
- Raise:
- FileNotExistsError:
The specified file doesn’t exists
- UnknowFileTypeError:
Unsupported file type
- pdbstore.io.file.extract_dbg_info(file_path: str | Path) Tuple[str, str] | None
Extract debugging information from a pe file.
- Parameters:
file_path – Path to the pefile
- Returns:
A tuple containing debugging informations:
item[0]: The pdb file name
item[1]: The unique pdb file identifier
- Raise:
- FileNotExistsError:
The specified file doesn’t exists
- UnknowFileTypeError:
Unsupported file type
- InvalidPEFile:
Invalid pe file (ex: exe or dll)
- pdbstore.io.file.get_file_size(path: str | Path) int
Get file size
- Parameters:
path – The file path
- Returns:
The file size
- pdbstore.io.file.read_binary_file(fname: str | Path) Any
Read all content of a binary file
- Parameters:
fname – Path to the text file to be read.
- Returns:
The file content.
- Raise:
- ReadFileError:
An errors occurs when reading the file.
- pdbstore.io.file.read_file(fname: str | Path, mode: str = 'rb', encoding: str | None = None) Any
Read all contents of a file
- Returns:
The file contents
- Raise:
- ReadFileError:
An errors occurs when reading the file
- pdbstore.io.file.read_text_file(fname: str | Path, splitlines: bool | None = False) Any
Read all content of a text file
- Parameters:
fname – Path to the text file to be read
splitlines – True to retrieve list of read lines, else False to retrieve the text file content as it is
- Returns:
The file content
- Raise:
- ReadFileError:
An errors occurs when reading the file