"""
paths.py

Purpose:
  Centralize project paths used by the Flask application so that modules do not
  compute their own base directories. This simplifies maintenance and allows a
  single point of change if the layout evolves.

Exports:
  - ROOT_DIR: Absolute path to repository root (where `app.py` resides)
  - STATIC_PATH: Absolute path to `static/`
  - DB_PATH: Absolute path to the SQLite database file `theialogin.db`
"""

import os


ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
# app_modules/ -> project root is one directory up
ROOT_DIR = os.path.dirname(ROOT_DIR)
STATIC_PATH = os.path.join(ROOT_DIR, 'static')
# Allow overriding DB path via environment (useful in Apache/mod_wsgi environments)
DB_PATH = os.getenv('DATABASE_PATH') or os.path.join(ROOT_DIR, 'theialogin.db')

# Real path to User-photos directory; allow overriding when it is a symlink to
# an external volume to keep deletion security checks correct under mod_wsgi.
USER_PHOTOS_REAL = os.getenv('USER_PHOTOS_DIR_REAL') or os.path.realpath(
    os.path.join(STATIC_PATH, 'User-photos')
)


