resource folder

This commit is contained in:
klemek
2021-01-08 13:04:00 +01:00
parent 5a965bbc7a
commit 36e10d50d7
3 changed files with 9 additions and 2 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
import re
import json
import logging
from os import path
from .utils import get_resource_path
EXTRA_EMOJI = {
"thumbup": "1f44d",
@@ -68,7 +69,7 @@ regex = re.compile("(<a?:[\\w\\-\\~]+:\\d+>|:[\\w\\-\\~]+:)")
def load_emojis():
global global_list, unicode_list, regex
emoji_list = []
with open(path.join(path.dirname(__file__), "emoji.json"), mode="r") as f:
with open(get_resource_path("emoji.json"), mode="r") as f:
emoji_list = json.loads(f.readline().strip())
for emoji in EXTRA_EMOJI:
emoji_list += [{"short_name": emoji, "unified": EXTRA_EMOJI[emoji]}]
+6
View File
@@ -26,6 +26,12 @@ def is_extension(filepath: str, ext_list: List[str]) -> bool:
return file_extension in ext_list
def get_resource_path(filename: str) -> str:
return os.path.realpath(
os.path.join(os.path.dirname(__file__), "..", "resources", filename)
)
# LISTS