MCPcopy
hub / github.com/freedomofpress/dangerzone / get_resource_path

Function get_resource_path

dangerzone/util.py:45–63  ·  view source on GitHub ↗
(filename: str)

Source from the content-addressed store, hash-verified

43
44
45def get_resource_path(filename: str) -> Path:
46 if getattr(sys, "dangerzone_dev", False):
47 # Look for resources directory relative to python file
48 project_root = Path(__file__).parent.parent
49 prefix = project_root / "share"
50 else:
51 if platform.system() == "Darwin":
52 bin_path = Path(sys.executable)
53 app_path = bin_path.parent.parent
54 prefix = app_path / "Resources" / "share"
55 elif platform.system() == "Linux":
56 prefix = Path(sys.prefix) / "share" / "dangerzone"
57 elif platform.system() == "Windows":
58 exe_path = Path(sys.executable)
59 dz_install_path = exe_path.parent
60 prefix = dz_install_path / "share"
61 else:
62 raise NotImplementedError(f"Unsupported system {platform.system()}")
63 return prefix / filename
64
65
66def get_tessdata_dir() -> Path:

Callers 15

get_podman_pathFunction · 0.85
load_image_tarballFunction · 0.85
expected_image_nameFunction · 0.85
__init__Method · 0.85
get_tessdata_dirFunction · 0.85
get_versionFunction · 0.85
cosign.pyFile · 0.85
_cosign_runFunction · 0.85
is_container_tar_bundledFunction · 0.85
signatures.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected