fix: 修改日志和配置文件路径以支持打包应用

将日志输出从标准错误改为文件,并调整配置文件和日志文件的路径处理,使其在打包后的应用中也能正常工作
This commit is contained in:
2026-03-26 12:03:41 +08:00
parent cb73725b6c
commit 41ccd4174e
3 changed files with 5 additions and 2 deletions

View File

@@ -13,9 +13,12 @@ from PySide6.QtWidgets import (QApplication, QMainWindow, QPushButton, QMessageB
from PySide6.QtCore import Qt, QThread, Signal from PySide6.QtCore import Qt, QThread, Signal
from PySide6.QtGui import QFont from PySide6.QtGui import QFont
logger.add(sys.stderr, format="{time:YYYY-MM-DD HH:mm:ss} | {level} | {message}", level="INFO") logger.remove()
APP_DIR = os.path.dirname(os.path.abspath(sys.executable if getattr(sys, 'frozen', False) else __file__))
log_file = os.path.join(APP_DIR, "push_screen.log")
logger.add(log_file, format="{time:YYYY-MM-DD HH:mm:ss} | {level} | {message}", level="INFO", encoding="utf-8")
CONFIG_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") CONFIG_FILE = os.path.join(APP_DIR, "config.json")
def load_config(): def load_config():
if os.path.exists(CONFIG_FILE): if os.path.exists(CONFIG_FILE):

BIN
vi.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
vi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB