(filename: str)
| 43 | |
| 44 | |
| 45 | def 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 | |
| 66 | def get_tessdata_dir() -> Path: |
no outgoing calls
no test coverage detected