mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-14 02:56:36 +00:00
fix(fonts): resolve relative asset paths from the install root, not the cwd
resolve_asset_path checked os.path.exists(relative_path) unconditionally, so a relative asset path was still resolved against the process cwd first -- exactly the dependency this module exists to remove. An unrelated working directory that happens to contain assets/fonts/4x6-font.ttf (a stale checkout, a copied assets folder, another project) would shadow the real bundled font instead of the install root ever being consulted. Only an absolute path is now returned as-is; a relative path always resolves against _INSTALL_ROOT first, matching the docstring's stated contract. FontManager._resolve_asset_path delegates to this function, so it's covered by the same fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,7 +77,7 @@ def resolve_asset_path(relative_path: str) -> str:
|
||||
file written without ``WorkingDirectory``) silently loses every font and
|
||||
degrades to PIL's default face.
|
||||
"""
|
||||
if os.path.exists(relative_path):
|
||||
if os.path.isabs(relative_path) and os.path.exists(relative_path):
|
||||
return relative_path
|
||||
candidate = _INSTALL_ROOT / relative_path
|
||||
if candidate.exists():
|
||||
|
||||
Reference in New Issue
Block a user