Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zh99998 committed Nov 4, 2016
1 parent f4f5f72 commit 7c65c4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"webpack-shell-plugin": "^0.4.2"
},
"dependencies": {
"bluebird": "^3.4.6"
"bluebird": "^3.4.6",
"fs-extra": "^1.0.0"
}
}
24 changes: 12 additions & 12 deletions src/lib/sudoer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {watchFile, unwatchFile, unlink, createReadStream, createWriteStream} fro
import {normalize, join, dirname} from 'path';
import {createHash} from 'crypto';

import {copy} from 'fs-extra';

import {readFile, writeFile, exec, spawn, mkdir, stat} from '~/lib/utils';

let {platform, env} = process;
Expand Down Expand Up @@ -61,18 +63,16 @@ class SudoerUnix extends Sudoer {
if (!this.options.name) { this.options.name = 'Electron'; }
}

async copy(source, target) {
return new Promise(async (resolve, reject) => {
source = this.escapeDoubleQuotes(normalize(source));
target = this.escapeDoubleQuotes(normalize(target));
try {
let result = await exec(`/bin/cp -R -p "${source}" "${target}"`);
resolve(result);
}
catch (err) {
reject(err);
}
});
copy(source, target) {
return new Promise((resolve, reject) => {
copy(source, target, (error)=>{
if(error){
reject(error);
}else{
resolve();
}
})
})
}

async remove(target) {
Expand Down

0 comments on commit 7c65c4b

Please sign in to comment.