添加PyInstaller macOS打包支持:资源路径处理、multiprocessing兼容、配置文件外置
Some checks failed
Docker Build and Push / check-secrets (push) Successful in 2s
Docker Build and Push / build-and-push (cpu, latest) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 11.8) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.6) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.8) (push) Has been skipped
Docker Build and Push / build-and-push (directml, latest) (push) Has been skipped
Build Windows CPU / build (push) Has been cancelled
Build Windows CUDA 11.8 / build (push) Has been cancelled
Build Windows CUDA 12.6 / build (push) Has been cancelled
Build Windows CUDA 12.8 / build (push) Has been cancelled
Build Windows DirectML / build (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
flavioy
2026-04-09 22:08:37 +08:00
parent 2d1d3fe37b
commit ec94f2e04b
3 changed files with 19 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import os
import sys
from pathlib import Path
from qfluentwidgets import (qconfig, ConfigItem, QConfig, OptionsValidator, BoolValidator, OptionsConfigItem,
EnumSerializer, RangeValidator, RangeConfigItem, ConfigValidator)
@@ -101,7 +102,13 @@ class Config(QConfig):
# 视频保存目录
saveDirectory = ConfigItem("Main", "SaveDirectory", "", ConfigValidator())
CONFIG_FILE = 'config/config.json'
# PyInstaller 打包后配置文件写入 .app bundle 同级目录(避免修改签名)
if getattr(sys, 'frozen', False):
# sys.executable -> Contents/MacOS/VideoSubtitleRemover, 向上3级到 .app 所在目录
_app_dir = os.path.dirname(os.path.dirname(os.path.dirname(sys.executable)))
CONFIG_FILE = os.path.join(_app_dir, 'config', 'config.json')
else:
CONFIG_FILE = 'config/config.json'
config = Config()
qconfig.load(CONFIG_FILE, config)