social/barkshark_social/misc.py
2024-04-18 22:36:06 -04:00

12 lines
310 B
Python

from importlib.resources import files as PackageFiles
from pathlib import Path
def get_resource(path: str) -> Path:
return Path(str(PackageFiles('barkshark_social'))).joinpath(path)
def read_resource_text(path: str) -> str:
with get_resource(path).open("r", encoding = "utf-8") as fd:
return fd.read()