helperFunctions.fileSystem module

helperFunctions.fileSystem.file_is_empty(file_path)

Checks if a file is empty (i.e. has a size of 0 bytes).

Parameters:

file_path (Path) – The file to check.

Returns:

True if the file is empty and False otherwise.

Return type:

bool

helperFunctions.fileSystem.get_config_dir()

Returns the absolute path of the config directory

helperFunctions.fileSystem.get_relative_object_path(path, offset_path)

FACT extraction unpacks files into a temporary directory. These files have to be offset to get the path relative to the firmware filesystem root. Additionally, some filesystem extractors create an intermediate directory ‘fact_extracted’ that has to be removed.

Parameters:
  • path (Path) – The absolute path of the file related to the firmware or file object.

  • offset_path (Path) – The path of the unpacking directory (that needs to be removed from the file’s path).

Returns:

The relative path.

Return type:

str

helperFunctions.fileSystem.get_src_dir()

Retrieves the absolute path of the src directory.

Returns:

The (absolute) path of the src directory.

Return type:

str

helperFunctions.fileSystem.get_template_dir()

Retrieves the absolute path of the template directory.

Returns:

The (absolute) path of the template directory.

Return type:

Path