调整打包脚本使用 packaging 资源路径
This commit is contained in:
@@ -4,7 +4,9 @@ const https = require('https');
|
||||
const http = require('http');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const BASE_DIR = path.join(__dirname, '../electron/resources/extra');
|
||||
const PACKAGING_DIR = path.join(__dirname, '../packaging');
|
||||
const RESOURCE_DIR = path.join(PACKAGING_DIR, 'resources');
|
||||
const VENDOR_DIR = path.join(PACKAGING_DIR, 'vendor');
|
||||
|
||||
// 下载进度显示
|
||||
function downloadFile(url, destPath, description) {
|
||||
@@ -80,11 +82,11 @@ async function main() {
|
||||
|
||||
// 1. 下载 Python 3.12 嵌入式版本(使用淘宝镜像)
|
||||
console.log('\n📦 步骤 1/5: 下载 Python 3.12 嵌入式版本(国内镜像)');
|
||||
const pythonDir = path.join(BASE_DIR, 'common/python');
|
||||
const pythonDir = path.join(VENDOR_DIR, 'python-runtime');
|
||||
await fs.ensureDir(pythonDir);
|
||||
|
||||
if (!fs.existsSync(path.join(pythonDir, 'python.exe'))) {
|
||||
const pythonZip = path.join(BASE_DIR, 'python-3.12.0-embed-amd64.zip');
|
||||
const pythonZip = path.join(VENDOR_DIR, 'python-3.12.0-embed-amd64.zip');
|
||||
|
||||
// 尝试多个镜像源
|
||||
const mirrors = [
|
||||
@@ -206,7 +208,7 @@ trusted-host = pypi.tuna.tsinghua.edu.cn
|
||||
|
||||
// 4. FFmpeg 手动下载提示
|
||||
console.log('\n📦 步骤 4/5: FFmpeg(需要手动下载)');
|
||||
const ffmpegDir = path.join(BASE_DIR, 'win-x86');
|
||||
const ffmpegDir = path.join(VENDOR_DIR, 'ffmpeg');
|
||||
await fs.ensureDir(ffmpegDir);
|
||||
|
||||
if (!fs.existsSync(path.join(ffmpegDir, 'ffmpeg.exe'))) {
|
||||
@@ -226,7 +228,7 @@ trusted-host = pypi.tuna.tsinghua.edu.cn
|
||||
|
||||
// 5. Chromium
|
||||
console.log('\n📦 步骤 5/5: Chromium 浏览器');
|
||||
const chromiumDir = path.join(BASE_DIR, 'common/chromium');
|
||||
const chromiumDir = path.join(RESOURCE_DIR, 'common/chromium');
|
||||
await fs.ensureDir(chromiumDir);
|
||||
|
||||
if (!fs.existsSync(path.join(chromiumDir, 'chrome-win'))) {
|
||||
@@ -268,7 +270,7 @@ trusted-host = pypi.tuna.tsinghua.edu.cn
|
||||
|
||||
// 6. AI 模型
|
||||
console.log('\n📦 步骤 6/6: AI 模型');
|
||||
const modelsDir = path.join(BASE_DIR, 'common/models');
|
||||
const modelsDir = path.join(VENDOR_DIR, 'models');
|
||||
await fs.ensureDir(modelsDir);
|
||||
|
||||
const u2netPath = path.join(modelsDir, 'u2net.onnx');
|
||||
|
||||
Reference in New Issue
Block a user