bd9acb17 by shady

准备最终的打包版本

1 parent 80827101
......@@ -19,21 +19,33 @@ pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
exclude_binaries=True,
name='ZB100ImageGenerator',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['zb100_kehuan.ico'],
icon=['zb100_mac.icns'],
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='ZB100ImageGenerator',
)
app = BUNDLE(
coll,
name='ZB100ImageGenerator.app',
icon='zb100_mac.icns',
bundle_identifier=None,
)
......
......@@ -27,9 +27,10 @@ rm -rf build dist *.spec
# Build executable
echo "Building executable..."
pyinstaller --name="ZB100ImageGenerator" \
--onefile \
--onedir \
--windowed \
--add-data "config.json:." \
--icon=zb100_mac.icns \
image_generator.py
# Check if build was successful
......
......@@ -29,17 +29,17 @@ if exist "*.spec" del /q *.spec
REM Build executable
echo Building executable...
pyinstaller --name="ZB100ImageGenerator" ^
--onefile ^
--onedir ^
--windowed ^
--icon=zb100_kehuan.ico ^
--add-data "config.json;." ^
image_generator.py
REM Check if build was successful
if exist "dist\ZB100ImageGenerator.exe" (
if exist "dist\ZB100ImageGenerator\ZB100ImageGenerator.exe" (
echo ================================
echo Build successful!
echo Executable: dist\ZB100ImageGenerator.exe
echo Executable: dist\ZB100ImageGenerator\ZB100ImageGenerator.exe
echo ================================
) else (
echo ================================
......
......@@ -19,6 +19,7 @@ import io
import json
import os
import sys
import shutil
import tempfile
import platform
from pathlib import Path
......@@ -982,6 +983,26 @@ def main():
config_dir.mkdir(parents=True, exist_ok=True)
config_path = config_dir / 'config.json'
# If config doesn't exist in user directory, copy from bundled resources
if not config_path.exists():
if getattr(sys, 'frozen', False):
# Running as bundled app - look in Resources folder (macOS .app bundle)
if platform.system() == 'Darwin':
# macOS: Contents/Resources/config.json
bundled_config = Path(sys.executable).parent.parent / 'Resources' / 'config.json'
else:
# Windows/Linux: same directory as executable
bundled_config = Path(sys.executable).parent / 'config.json'
if bundled_config.exists():
try:
shutil.copy2(bundled_config, config_path)
print(f"✓ Copied config from {bundled_config} to {config_path}")
except Exception as e:
print(f"✗ Failed to copy bundled config: {e}")
else:
print(f"✗ Bundled config not found at {bundled_config}")
db_config = None
last_user = ""
saved_password_hash = ""
......