Skip to content

Commit

Permalink
Fix location of config files for executable files (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
OzzieIsaacs committed Oct 28, 2023
1 parent c550d6c commit 5e3d0ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cps/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

# Base dir is parent of current file, necessary if called from different folder
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
# if executable file the files should be placed in the parent dir (parallel to the exe file)

STATIC_DIR = os.path.join(BASE_DIR, 'cps', 'static')
TEMPLATES_DIR = os.path.join(BASE_DIR, 'cps', 'templates')
TRANSLATIONS_DIR = os.path.join(BASE_DIR, 'cps', 'translations')
Expand All @@ -49,6 +51,9 @@
CONFIG_DIR = os.environ.get('CALIBRE_DBPATH', home_dir)
else:
CONFIG_DIR = os.environ.get('CALIBRE_DBPATH', BASE_DIR)
if getattr(sys, 'frozen', False):
CONFIG_DIR = os.path.abspath(os.path.join(CONFIG_DIR, os.pardir))


DEFAULT_SETTINGS_FILE = "app.db"
DEFAULT_GDRIVE_FILE = "gdrive.db"
Expand Down

0 comments on commit 5e3d0ec

Please sign in to comment.