#!/usr/bin/env python3
"""
KeyBunker Launcher - Sets up paths for embedded Python, then runs keyBunker.
Crashes visibly if anything goes wrong.
"""

import sys
import os

# Embedded Python's ._pth file restricts imports. Explicitly add
# the script directory and site-packages to sys.path.
script_dir = os.path.dirname(os.path.abspath(__file__))
install_dir = os.path.join(os.getenv('LOCALAPPDATA', ''), 'webSlinger')
site_packages = os.path.join(install_dir, 'site-packages')

sys.path.insert(0, script_dir)
sys.path.insert(0, site_packages)

os.chdir(script_dir)

# Run keyBunker directly - let it crash visibly
from keyBunker import keyBunker, KeyBunkerGUI
from PyQt5.QtWidgets import QApplication

app = QApplication(sys.argv)
kb = keyBunker()
gui = KeyBunkerGUI(kb)
gui.show()
sys.exit(app.exec_())
