CityBEM-CityLayers-SaeedRay.../node_modules/@electron-forge/installer-darwin/dist/InstallerDarwin.js

63 lines
5.8 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "InstallerOptions", {
enumerable: true,
get: function () {
return _installerBase.InstallerOptions;
}
});
exports.default = void 0;
require("source-map-support/register");
var _installerBase = _interopRequireWildcard(require("@electron-forge/installer-base"));
var _fsExtra = _interopRequireDefault(require("fs-extra"));
var _path = _interopRequireDefault(require("path"));
var _util = require("util");
var _sudoPrompt = _interopRequireDefault(require("sudo-prompt"));
var _child_process = require("child_process");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
class InstallerDarwin extends _installerBase.default {
async moveApp(appPath, targetApplicationPath, spinner, copyInstead = false) {
let writeAccess = true;
try {
await _fsExtra.default.access('/Applications', _fsExtra.default.constants.W_OK);
} catch (err) {
writeAccess = false;
}
if (await _fsExtra.default.pathExists(targetApplicationPath)) {
spinner.fail();
throw new Error(`The application "${_path.default.basename(targetApplicationPath)}" appears to already exist in /Applications.`);
}
const moveCommand = `${copyInstead ? 'cp -r' : 'mv'} "${appPath}" "${targetApplicationPath}"`;
if (writeAccess) {
await (0, _util.promisify)(_child_process.exec)(moveCommand);
} else {
await (0, _util.promisify)(_sudoPrompt.default.exec)(moveCommand, {
name: 'Electron Forge'
});
}
}
}
exports.default = InstallerDarwin;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9JbnN0YWxsZXJEYXJ3aW4udHMiXSwibmFtZXMiOlsiSW5zdGFsbGVyRGFyd2luIiwiSW5zdGFsbGVyQmFzZSIsIm1vdmVBcHAiLCJhcHBQYXRoIiwidGFyZ2V0QXBwbGljYXRpb25QYXRoIiwic3Bpbm5lciIsImNvcHlJbnN0ZWFkIiwid3JpdGVBY2Nlc3MiLCJmcyIsImFjY2VzcyIsImNvbnN0YW50cyIsIldfT0siLCJlcnIiLCJwYXRoRXhpc3RzIiwiZmFpbCIsIkVycm9yIiwicGF0aCIsImJhc2VuYW1lIiwibW92ZUNvbW1hbmQiLCJleGVjIiwic3VkbyIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7OztBQUNBOztBQUVBOztBQUNBOztBQUNBOztBQUNBOztBQUNBOzs7Ozs7OztBQUllLE1BQWVBLGVBQWYsU0FBdUNDLHNCQUF2QyxDQUFxRDtBQUNyRCxRQUFQQyxPQUFPLENBQ1hDLE9BRFcsRUFFWEMscUJBRlcsRUFHWEMsT0FIVyxFQUlYQyxXQUFXLEdBQUcsS0FKSCxFQUtYO0FBQ0EsUUFBSUMsV0FBVyxHQUFHLElBQWxCOztBQUNBLFFBQUk7QUFDRixZQUFNQyxpQkFBR0MsTUFBSCxDQUFVLGVBQVYsRUFBMkJELGlCQUFHRSxTQUFILENBQWFDLElBQXhDLENBQU47QUFDRCxLQUZELENBRUUsT0FBT0Ms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