Sync from development - prepare for v0.1.2

This commit is contained in:
Omni
2025-09-18 08:18:59 +01:00
parent 70b18004e1
commit 1cd4caf04b
61 changed files with 1349 additions and 503 deletions

View File

@@ -14,15 +14,21 @@ import shutil
class LoggingHandler:
"""
Central logging handler for Jackify.
- Uses ~/Jackify/logs/ as the log directory.
- Uses configurable Jackify data directory for logs (default: ~/Jackify/logs/).
- Supports per-function log files (e.g., jackify-install-wabbajack.log).
- Handles log rotation and log directory creation.
Usage:
logger = LoggingHandler().setup_logger('install_wabbajack', 'jackify-install-wabbajack.log')
"""
def __init__(self):
self.log_dir = Path.home() / "Jackify" / "logs"
# Don't cache log_dir - use property to get fresh path each time
self.ensure_log_directory()
@property
def log_dir(self):
"""Get the current log directory (may change if config updated)."""
from jackify.shared.paths import get_jackify_logs_dir
return get_jackify_logs_dir()
def ensure_log_directory(self) -> None:
"""Ensure the log directory exists."""

65
jackify/shared/paths.py Normal file
View File

@@ -0,0 +1,65 @@
"""
Path utilities for Jackify.
This module provides standardized path resolution for Jackify directories,
supporting configurable data directory while keeping config in a fixed location.
"""
import os
from pathlib import Path
from typing import Optional
def get_jackify_data_dir() -> Path:
"""
Get the configurable Jackify data directory.
This directory contains:
- downloaded_mod_lists/
- logs/
- temporary proton prefixes during installation
Returns:
Path: The Jackify data directory (always set in config)
"""
try:
# Import here to avoid circular imports
from jackify.backend.handlers.config_handler import ConfigHandler
config_handler = ConfigHandler()
jackify_data_dir = config_handler.get('jackify_data_dir')
# Config handler now always ensures this is set, but fallback just in case
if jackify_data_dir:
return Path(jackify_data_dir).expanduser()
else:
return Path.home() / "Jackify"
except Exception:
# Emergency fallback if config system fails
return Path.home() / "Jackify"
def get_jackify_logs_dir() -> Path:
"""Get the logs directory within the Jackify data directory."""
return get_jackify_data_dir() / "logs"
def get_jackify_downloads_dir() -> Path:
"""Get the downloaded modlists directory within the Jackify data directory."""
return get_jackify_data_dir() / "downloaded_mod_lists"
def get_jackify_config_dir() -> Path:
"""
Get the Jackify configuration directory (always ~/.config/jackify).
This directory contains:
- config.json (settings)
- API keys and credentials
- Resource settings
Returns:
Path: Always ~/.config/jackify
"""
return Path.home() / ".config" / "jackify"

View File

@@ -51,9 +51,15 @@ def _clear_screen_fallback():
def print_jackify_banner():
"""Print the Jackify application banner"""
print("""
from jackify import __version__
version_text = f"Jackify CLI ({__version__})"
# Center the version text in the banner (72 chars content width)
padding = (72 - len(version_text)) // 2
centered_version = " " * padding + version_text + " " * (72 - len(version_text) - padding)
print(f"""
╔════════════════════════════════════════════════════════════════════════╗
Jackify CLI (pre-alpha)
{centered_version}
║ ║
║ A tool for installing and configuring modlists ║
║ & associated utilities on Linux ║