summaryrefslogtreecommitdiff
path: root/swiftstory/cards.py
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory/cards.py')
-rw-r--r--swiftstory/cards.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/swiftstory/cards.py b/swiftstory/cards.py
index d570f87..62f1e37 100644
--- a/swiftstory/cards.py
+++ b/swiftstory/cards.py
@@ -1,16 +1,18 @@
import json
+import os
+
+import pkg_resources
class Cards:
@staticmethod
def get_white_cards(lang):
''' Read the file containing the white cards and return a list of cards '''
- with open(f'usr/share/swiftstory/lang/{lang}/cards/white.json', encoding='utf-8') as fh:
- return json.load(fh)
+ fh = pkg_resources.resource_stream(__name__, os.path.join("data/lang", lang, "cards/white.json"))
+ return json.load(fh)
@staticmethod
def get_black_cards(lang):
''' Read the file containing the black cards and return a list of cards '''
-
- with open(f'usr/share/swiftstory/lang/{lang}/cards/black.json', encoding='utf-8') as fh:
- return json.load(fh)
+ fh = pkg_resources.resource_stream(__name__, os.path.join("data/lang", lang, "cards/black.json"))
+ return json.load(fh)