@@ -18,7 +18,7 @@ import {
18
18
import { CURRENT_APP_INSTALLER_FILE_NAME , CURRENT_APP_PACKAGE_FILE_NAME , PackageFileInfo , UUID } from "builder-util-runtime"
19
19
import _debug from "debug"
20
20
import * as fs from "fs"
21
- import { mkdir , readFile , rm , stat } from "fs-extra"
21
+ import { readFile , stat , unlink } from "fs-extra"
22
22
import * as path from "path"
23
23
import { getBinFromUrl } from "../../binDownload"
24
24
import { Target } from "../../core"
@@ -357,7 +357,7 @@ export class NsisTarget extends Target {
357
357
defines . UNINSTALLER_OUT_FILE = definesUninstaller . UNINSTALLER_OUT_FILE
358
358
359
359
await this . executeMakensis ( defines , commands , sharedHeader + ( await this . computeFinalScript ( script , true , archs ) ) )
360
- await Promise . all < any > ( [ packager . sign ( installerPath ) , defines . UNINSTALLER_OUT_FILE == null ? Promise . resolve ( ) : rm ( path . dirname ( defines . UNINSTALLER_OUT_FILE ) , { recursive : true } ) ] )
360
+ await Promise . all < any > ( [ packager . sign ( installerPath ) , defines . UNINSTALLER_OUT_FILE == null ? Promise . resolve ( ) : unlink ( defines . UNINSTALLER_OUT_FILE ) ] )
361
361
362
362
const safeArtifactName = computeSafeArtifactNameIfNeeded ( installerFilename , ( ) => this . generateGitHubInstallerName ( primaryArch , defaultArch ) )
363
363
let updateInfo : any
@@ -411,9 +411,7 @@ export class NsisTarget extends Target {
411
411
// https://github.com/electron-userland/electron-builder/issues/2103
412
412
// it is more safe and reliable to write uninstaller to our out dir
413
413
// to support parallel builds, the uninstaller path must be unique to each target and arch combination
414
- const uninstallDir = path . join ( this . outDir , `__uninstaller-${ Math . floor ( Math . random ( ) * Date . now ( ) ) } ` )
415
- await mkdir ( uninstallDir )
416
- const uninstallerPath = path . join ( uninstallDir , `__uninstaller-${ this . name } -${ this . packager . appInfo . sanitizedName } .exe` )
414
+ const uninstallerPath = path . join ( this . outDir , `${ path . basename ( installerPath , "exe" ) } __uninstaller.exe` )
417
415
const isWin = process . platform === "win32"
418
416
defines . BUILD_UNINSTALLER = null
419
417
defines . UNINSTALLER_OUT_FILE = isWin ? uninstallerPath : path . win32 . join ( "Z:" , uninstallerPath )
0 commit comments