mirror of
https://gitee.com/myxzgzs/boyue_jnpf.git
synced 2025-08-10 16:22:44 +08:00
47 lines
1.9 KiB
JavaScript
47 lines
1.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.StageDir = void 0;
|
|
exports.createStageDir = createStageDir;
|
|
exports.createStageDirPath = createStageDirPath;
|
|
exports.getWindowsInstallationDirName = getWindowsInstallationDirName;
|
|
exports.getWindowsInstallationAppPackageName = getWindowsInstallationAppPackageName;
|
|
const builder_util_1 = require("builder-util");
|
|
const fs = require("fs/promises");
|
|
const path = require("path");
|
|
class StageDir {
|
|
constructor(dir) {
|
|
this.dir = dir;
|
|
}
|
|
getTempFile(name) {
|
|
return this.dir + path.sep + name;
|
|
}
|
|
cleanup() {
|
|
if (!builder_util_1.debug.enabled || process.env.ELECTRON_BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG === "true") {
|
|
return fs.rm(this.dir, { recursive: true, force: true });
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
toString() {
|
|
return this.dir;
|
|
}
|
|
}
|
|
exports.StageDir = StageDir;
|
|
async function createStageDir(target, packager, arch) {
|
|
return new StageDir(await createStageDirPath(target, packager, arch));
|
|
}
|
|
async function createStageDirPath(target, packager, arch) {
|
|
const tempDir = packager.info.stageDirPathCustomizer(target, packager, arch);
|
|
await fs.rm(tempDir, { recursive: true, force: true });
|
|
await fs.mkdir(tempDir, { recursive: true });
|
|
return tempDir;
|
|
}
|
|
// https://github.com/electron-userland/electron-builder/issues/3100
|
|
// https://github.com/electron-userland/electron-builder/commit/2539cfba20dc639128e75c5b786651b652bb4b78
|
|
function getWindowsInstallationDirName(appInfo, isTryToUseProductName) {
|
|
return isTryToUseProductName && /^[-_+0-9a-zA-Z .]+$/.test(appInfo.productFilename) ? appInfo.productFilename : appInfo.sanitizedName;
|
|
}
|
|
// https://github.com/electron-userland/electron-builder/issues/6747
|
|
function getWindowsInstallationAppPackageName(appName) {
|
|
return appName.replace(/\//g, "\\");
|
|
}
|
|
//# sourceMappingURL=targetUtil.js.map
|