@@ -1162,14 +1162,22 @@ class BaseBuilder {
11621162 return 0 ; // Disable proxy feature if version detection fails
11631163 }
11641164 }
1165+ getCargoTargetDir ( ) {
1166+ return process . env . CARGO_TARGET_DIR || path . join ( 'src-tauri' , 'target' ) ;
1167+ }
1168+ resolveBuildPath ( npmDirectory , buildPath ) {
1169+ return path . isAbsolute ( buildPath )
1170+ ? buildPath
1171+ : path . join ( npmDirectory , buildPath ) ;
1172+ }
11651173 getBasePath ( ) {
11661174 const basePath = this . options . debug ? 'debug' : 'release' ;
1167- return `src-tauri/target/ ${ basePath } / bundle/` ;
1175+ return path . join ( this . getCargoTargetDir ( ) , basePath , ' bundle' ) ;
11681176 }
11691177 getBuildAppPath ( npmDirectory , fileName , fileType ) {
11701178 // For app bundles on macOS, the directory is 'macos', not 'app'
11711179 const bundleDir = fileType . toLowerCase ( ) === 'app' ? 'macos' : fileType . toLowerCase ( ) ;
1172- return path . join ( npmDirectory , this . getBasePath ( ) , bundleDir , `${ fileName } .${ fileType } ` ) ;
1180+ return path . join ( this . resolveBuildPath ( npmDirectory , this . getBasePath ( ) ) , bundleDir , `${ fileName } .${ fileType } ` ) ;
11731181 }
11741182 /**
11751183 * Copy raw binary file to output directory
@@ -1196,9 +1204,9 @@ class BaseBuilder {
11961204 const binaryName = this . getBinaryName ( appName ) ;
11971205 // Handle cross-platform builds
11981206 if ( this . options . multiArch || this . hasArchSpecificTarget ( ) ) {
1199- return path . join ( npmDirectory , this . getArchSpecificPath ( ) , basePath , binaryName ) ;
1207+ return path . join ( this . resolveBuildPath ( npmDirectory , this . getArchSpecificPath ( ) ) , basePath , binaryName ) ;
12001208 }
1201- return path . join ( npmDirectory , 'src-tauri/target' , basePath , binaryName ) ;
1209+ return path . join ( this . resolveBuildPath ( npmDirectory , this . getCargoTargetDir ( ) ) , basePath , binaryName ) ;
12021210 }
12031211 /**
12041212 * Get the output path for the raw binary file
@@ -1229,7 +1237,7 @@ class BaseBuilder {
12291237 * Get architecture-specific path for binary
12301238 */
12311239 getArchSpecificPath ( ) {
1232- return 'src-tauri/target' ; // Override in subclasses if needed
1240+ return this . getCargoTargetDir ( ) ; // Override in subclasses if needed
12331241 }
12341242}
12351243BaseBuilder . ARCH_MAPPINGS = {
@@ -1315,15 +1323,21 @@ class MacBuilder extends BaseBuilder {
13151323 const basePath = this . options . debug ? 'debug' : 'release' ;
13161324 const actualArch = this . getActualArch ( ) ;
13171325 const target = this . getTauriTarget ( actualArch , 'darwin' ) ;
1318- return `src-tauri/target/${ target } /${ basePath } /bundle` ;
1326+ if ( ! target ) {
1327+ throw new Error ( `Unsupported architecture: ${ actualArch } for macOS` ) ;
1328+ }
1329+ return path . join ( this . getCargoTargetDir ( ) , target , basePath , 'bundle' ) ;
13191330 }
13201331 hasArchSpecificTarget ( ) {
13211332 return true ;
13221333 }
13231334 getArchSpecificPath ( ) {
13241335 const actualArch = this . getActualArch ( ) ;
13251336 const target = this . getTauriTarget ( actualArch , 'darwin' ) ;
1326- return `src-tauri/target/${ target } ` ;
1337+ if ( ! target ) {
1338+ throw new Error ( `Unsupported architecture: ${ actualArch } for macOS` ) ;
1339+ }
1340+ return path . join ( this . getCargoTargetDir ( ) , target ) ;
13271341 }
13281342}
13291343
@@ -1354,14 +1368,26 @@ class WinBuilder extends BaseBuilder {
13541368 getBasePath ( ) {
13551369 const basePath = this . options . debug ? 'debug' : 'release' ;
13561370 const target = this . getTauriTarget ( this . buildArch , 'win32' ) ;
1357- return `src-tauri/target/${ target } /${ basePath } /bundle/` ;
1371+ if ( ! target ) {
1372+ throw new Error ( `Unsupported architecture: ${ this . buildArch } for Windows` ) ;
1373+ }
1374+ return path . join ( this . getCargoTargetDir ( ) , target , basePath , 'bundle' ) ;
13581375 }
13591376 hasArchSpecificTarget ( ) {
13601377 return true ;
13611378 }
13621379 getArchSpecificPath ( ) {
13631380 const target = this . getTauriTarget ( this . buildArch , 'win32' ) ;
1364- return `src-tauri/target/${ target } ` ;
1381+ if ( ! target ) {
1382+ throw new Error ( `Unsupported architecture: ${ this . buildArch } for Windows` ) ;
1383+ }
1384+ return path . join ( this . getCargoTargetDir ( ) , target ) ;
1385+ }
1386+ getRawBinaryPath ( appName ) {
1387+ return `${ appName } .exe` ;
1388+ }
1389+ getBinaryName ( appName ) {
1390+ return `pake-${ generateIdentifierSafeName ( appName ) } .exe` ;
13651391 }
13661392}
13671393
@@ -1556,7 +1582,10 @@ post_remove() {
15561582 const basePath = this . options . debug ? 'debug' : 'release' ;
15571583 if ( this . buildArch === 'arm64' ) {
15581584 const target = this . getTauriTarget ( this . buildArch , 'linux' ) ;
1559- return `src-tauri/target/${ target } /${ basePath } /bundle/` ;
1585+ if ( ! target ) {
1586+ throw new Error ( `Unsupported architecture: ${ this . buildArch } for Linux` ) ;
1587+ }
1588+ return path . join ( this . getCargoTargetDir ( ) , target , basePath , 'bundle' ) ;
15601589 }
15611590 return super . getBasePath ( ) ;
15621591 }
@@ -1572,7 +1601,10 @@ post_remove() {
15721601 getArchSpecificPath ( ) {
15731602 if ( this . buildArch === 'arm64' ) {
15741603 const target = this . getTauriTarget ( this . buildArch , 'linux' ) ;
1575- return `src-tauri/target/${ target } ` ;
1604+ if ( ! target ) {
1605+ throw new Error ( `Unsupported architecture: ${ this . buildArch } for Linux` ) ;
1606+ }
1607+ return path . join ( this . getCargoTargetDir ( ) , target ) ;
15761608 }
15771609 return super . getArchSpecificPath ( ) ;
15781610 }
0 commit comments