tracts.driver_utils.locate_file_path#

locate_file_path(filename, script_dir, absolute_driver_yaml_path=None, verbose=False)#

Locates the file path for a given filename by searching in multiple locations. The search order is as follows: 1. Working directory 2. Script directory (if provided) 3. Directory of the driver yaml file (if provided) 4. Directories in sys.path

Parameters:
  • filename (str) – The name of the file to locate.

  • script_dir (str | Path | None) – The directory of the script, if provided.

  • absolute_driver_yaml_path (str | Path | None) – The absolute path to the driver yaml file, if provided.

  • verbose (bool) – If True, logs the search process.

Returns:

The path to the located file, or None if the file is not found.

Return type:

Optional[Path]