diff --git a/script/copy-folder.cmd b/script/copy-folder.cmd deleted file mode 100644 index 1021c30f3..000000000 --- a/script/copy-folder.cmd +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -set USAGE=Usage: %0 source destination - -if [%1] == [] ( - echo %USAGE% - exit 1 -) -if [%2] == [] ( - echo %USAGE% - exit 2 -) - -:: rm -rf %2 -if exist %2 rmdir %2 /s /q - -:: cp -rf %1 %2 -(robocopy %1 %2 /e) ^& IF %ERRORLEVEL% LEQ 1 exit 0 diff --git a/script/lib/install-application.js b/script/lib/install-application.js index d246c7b94..d21a6e53c 100644 --- a/script/lib/install-application.js +++ b/script/lib/install-application.js @@ -3,7 +3,6 @@ const fs = require('fs-extra') const handleTilde = require('./handle-tilde') const path = require('path') -const runas = require('runas') const template = require('lodash.template') const CONFIG = require('../config') @@ -31,11 +30,12 @@ module.exports = function (packagedAppPath, installDir) { fs.copySync(packagedAppPath, installationDirPath) } catch (e) { console.log(`Administrator elevation required to install into "${installationDirPath}"`) - const copyScriptPath = path.join(CONFIG.repositoryRootPath, 'script', 'copy-folder.cmd') - const exitCode = runas('cmd', ['/c', copyScriptPath, packagedAppPath, installationDirPath], {admin: true}) - if (exitCode !== 0) { - throw new Error(`Installation failed. "${copyScriptPath}" exited with status: ${exitCode}`) - } + const fsAdmin = require('fs-admin') + return new Promise((resolve, reject) => { + fsAdmin.recursiveCopy(packagedAppPath, installationDirPath, (error) => { + error ? reject(error) : resolve() + }) + }) } } else { const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' @@ -95,4 +95,6 @@ module.exports = function (packagedAppPath, installDir) { console.log(`Changing permissions to 755 for "${installationDirPath}"`) fs.chmodSync(installationDirPath, '755') } + + return Promise.resolve() } diff --git a/script/package.json b/script/package.json index 454d561aa..59ca93375 100644 --- a/script/package.json +++ b/script/package.json @@ -13,6 +13,7 @@ "electron-mksnapshot": "~1.6", "electron-packager": "7.3.0", "electron-winstaller": "2.6.2", + "fs-admin": "^0.1.5", "fs-extra": "0.30.0", "glob": "7.0.3", "joanna": "0.0.9", @@ -25,7 +26,6 @@ "npm": "5.3.0", "passwd-user": "2.1.0", "pegjs": "0.9.0", - "runas": "3.1.1", "season": "5.3.0", "semver": "5.3.0", "standard": "8.4.0",