13 lines
352 B
Python
13 lines
352 B
Python
import os
|
|
import sys
|
|
from functools import cache
|
|
|
|
_DEFAULT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
@cache
|
|
def resource_path(relative_path: str) -> str:
|
|
"""Get absolute path to resource, works for dev and for PyInstaller"""
|
|
base_path = getattr(sys, "_MEIPASS", _DEFAULT)
|
|
return os.path.join(base_path, relative_path)
|