Ready for alpha?

This commit is contained in:
Mike Young
2019-11-20 22:22:09 -05:00
parent 8e551f3f32
commit bf26dc39a8
16 changed files with 58 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import json
import os
import pathlib
import sys
@@ -9,17 +10,17 @@ class Config:
"""
_fp = "config.json"
print(os.path)
def __init__(self, root=os.path.abspath("../../")):
_data = self.open_file(root)
def __init__(self, root):
_cp = pathlib.Path.joinpath(root, self._fp)
_data = self.open_file(_cp)
self.book_path = _data["BOOKPATH"]
self.TITLE = _data["TITLE"]
self.VERSION = _data["VERSION"]
self.TITLE = self.TITLE + " ver " + self.VERSION
self.book_shelf = _data["BOOKSHELF"]
# self.catalogue_db = "data/catalogue.db"
self.catalogue_db = root + "/" + _data["DATABASE"]
self.catalogue_db = str(root) + "/" + _data["DATABASE"]
self.file_array = [
self.book_shelf,
self.catalogue_db,
@@ -27,7 +28,7 @@ class Config:
self.root = root
self.auto_scan = True
def open_file(self, root):
with open(root + "/" + self._fp, "r") as read_file:
def open_file(self, _cp):
with open(str(_cp), "r") as read_file:
data = json.load(read_file)
return data