@@ -65,7 +65,8 @@ async function main() {
6565
6666 // Step 2: 创建目录结构
6767 step ( 2 , TOTAL , "创建目录..." , "Creating directories..." ) ;
68- [ INSTALL_DIR , APP_DIR , DATA_DIR , path . join ( DATA_DIR , "inbox" ) , path . join ( DATA_DIR , "sync" ) ] . forEach ( d => {
68+ [ INSTALL_DIR , APP_DIR , DATA_DIR , path . join ( DATA_DIR , "inbox" ) ,
69+ path . join ( DATA_DIR , "sync" ) , path . join ( DATA_DIR , "syncthing" ) ] . forEach ( d => {
6970 fs . mkdirSync ( d , { recursive : true } ) ;
7071 } ) ;
7172 log ( `✓ 安装目录: ${ INSTALL_DIR } ` , `Install dir: ${ INSTALL_DIR } ` ) ;
@@ -80,6 +81,26 @@ async function main() {
8081 process . exit ( 1 ) ;
8182 }
8283
84+ // 释放 syncthing 二进制: 包内随 app 部署在 data_synth/syncthing/,运行时需 data/syncthing/
85+ // Release syncthing binary: bundled under app/data_synth/syncthing/, runtime expects data/syncthing/
86+ try {
87+ const bundled = path . join ( APP_DIR , "data_synth" , "syncthing" , "syncthing.exe" ) ;
88+ const dest = path . join ( DATA_DIR , "syncthing" , "syncthing.exe" ) ;
89+ if ( fs . existsSync ( bundled ) && ! fs . existsSync ( dest ) ) {
90+ fs . mkdirSync ( path . dirname ( dest ) , { recursive : true } ) ;
91+ fs . copyFileSync ( bundled , dest ) ;
92+ log ( "✓ syncthing 二进制已就位" , "Syncthing binary in place" ) ;
93+ } else if ( ! fs . existsSync ( bundled ) ) {
94+ log ( "⚠ 包内未找到 syncthing 二进制(同步功能不可用)" ,
95+ "⚠ syncthing binary not found in package (sync unavailable)" ) ;
96+ } else {
97+ log ( "✓ syncthing 二进制已存在" , "Syncthing binary already present" ) ;
98+ }
99+ } catch ( e ) {
100+ log ( `⚠ syncthing 二进制释放失败: ${ e . message } ` ,
101+ `⚠ Failed to deploy syncthing binary: ${ e . message } ` ) ;
102+ }
103+
83104 // Step 4: 创建 venv 并安装依赖
84105 step ( 4 , TOTAL , "创建虚拟环境并安装依赖(可能需要几分钟)..." , "Creating venv and installing dependencies (may take a few minutes)..." ) ;
85106 const venvPython = path . join ( VENV_DIR , "Scripts" , "python.exe" ) ;
0 commit comments