Skip to content

Commit

Permalink
chore: Refactor config.py to use EXECUTABLE_DIR instead of ROOT_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubAndrysek committed Sep 6, 2024
1 parent 126ec38 commit cf87601
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions forester-game-app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class Config:
if getattr(sys, "frozen", False):
FROZEN = True
PORT = 80
ROOT_DIR = Path(sys.executable).parent
EXECUTABLE_DIR = Path(sys.executable).parent
DATA_DIR = sys._MEIPASS
else:
FROZEN = False
PORT = 4444
ROOT_DIR = Path(__file__).parent
DATA_DIR = ROOT_DIR
EXECUTABLE_DIR = Path(__file__).parent
DATA_DIR = EXECUTABLE_DIR

# use live data if it exists
LIVE_DATA_FOLDER = Path(DATA_DIR) / LIVE_DATA_DIR
LIVE_DATA_FOLDER = Path(EXECUTABLE_DIR) / LIVE_DATA_DIR
TEMPLATES_FOLDER = Path(DATA_DIR) / TEMPLATES_DIR
GAMES_FOLDER = Path(DATA_DIR) / GAMES_DIR
ASSETS_FOLDER = Path(DATA_DIR) / ASSETS_DIR
Expand Down
2 changes: 1 addition & 1 deletion forester-game-app/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run_flask(config="config.Config"):
if len(sys.argv) > 1:
config.PORT = int(sys.argv[1])

logger = setup_logging(config.ROOT_DIR, config.LOG_FOLDER)
logger = setup_logging(config.EXECUTABLE_DIR, config.LOG_FOLDER)
logging.basicConfig(level=logging.INFO)

if not config.DEBUG:
Expand Down

0 comments on commit cf87601

Please sign in to comment.