1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getWindowsInstallationDirName = getWindowsInstallationDirName;
|
7 | exports.createStageDirPath = exports.createStageDir = exports.StageDir = void 0;
|
8 |
|
9 | function _bluebirdLst() {
|
10 | const data = require("bluebird-lst");
|
11 |
|
12 | _bluebirdLst = function () {
|
13 | return data;
|
14 | };
|
15 |
|
16 | return data;
|
17 | }
|
18 |
|
19 | function _fsExtraP() {
|
20 | const data = require("fs-extra-p");
|
21 |
|
22 | _fsExtraP = function () {
|
23 | return data;
|
24 | };
|
25 |
|
26 | return data;
|
27 | }
|
28 |
|
29 | var path = _interopRequireWildcard(require("path"));
|
30 |
|
31 | function _builderUtil() {
|
32 | const data = require("builder-util");
|
33 |
|
34 | _builderUtil = function () {
|
35 | return data;
|
36 | };
|
37 |
|
38 | return data;
|
39 | }
|
40 |
|
41 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
42 |
|
43 | class StageDir {
|
44 | constructor(dir) {
|
45 | this.dir = dir;
|
46 | }
|
47 |
|
48 | getTempFile(name) {
|
49 | return this.dir + path.sep + name;
|
50 | }
|
51 |
|
52 | cleanup() {
|
53 | if (!_builderUtil().debug.enabled || process.env.ELECTRON_BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG === "true") {
|
54 | return (0, _fsExtraP().remove)(this.dir);
|
55 | }
|
56 |
|
57 | return Promise.resolve();
|
58 | }
|
59 |
|
60 | toString() {
|
61 | return this.dir;
|
62 | }
|
63 |
|
64 | }
|
65 |
|
66 | exports.StageDir = StageDir;
|
67 |
|
68 | let createStageDir = (() => {
|
69 | var _ref = (0, _bluebirdLst().coroutine)(function* (target, packager, arch) {
|
70 | return new StageDir((yield createStageDirPath(target, packager, arch)));
|
71 | });
|
72 |
|
73 | return function createStageDir(_x, _x2, _x3) {
|
74 | return _ref.apply(this, arguments);
|
75 | };
|
76 | })();
|
77 |
|
78 | exports.createStageDir = createStageDir;
|
79 |
|
80 | let createStageDirPath = (() => {
|
81 | var _ref2 = (0, _bluebirdLst().coroutine)(function* (target, packager, arch) {
|
82 | const tempDir = packager.info.stageDirPathCustomizer(target, packager, arch);
|
83 | yield (0, _fsExtraP().emptyDir)(tempDir);
|
84 | return tempDir;
|
85 | });
|
86 |
|
87 | return function createStageDirPath(_x4, _x5, _x6) {
|
88 | return _ref2.apply(this, arguments);
|
89 | };
|
90 | })();
|
91 |
|
92 |
|
93 |
|
94 | exports.createStageDirPath = createStageDirPath;
|
95 |
|
96 | function getWindowsInstallationDirName(appInfo, isTryToUseProductName) {
|
97 | return isTryToUseProductName && /^[-_+0-9a-zA-Z .]+$/.test(appInfo.productFilename) ? appInfo.productFilename : appInfo.sanitizedName;
|
98 | }
|
99 |
|
\ | No newline at end of file |