check helper permissions

This commit is contained in:
antelle 2016-09-01 21:08:47 +03:00
parent ea8e8ec106
commit 8d4cdd9d59
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,7 @@ const AutoTypeNativeHelper = {
logger.error('Helper not found. Searched paths:', possiblePaths.join(', '));
throw 'Helper not found';
}
Launcher.ensureRunnable(helperPath);
logger.debug('Using auto-type helper', helperPath);
this._helperPath = helperPath;
return helperPath;

View File

@ -71,6 +71,17 @@ if (window.process && window.process.versions && window.process.versions.electro
statFile: function(path) {
return this.req('fs').statSync(path);
},
ensureRunnable: function(path) {
if (process.platform !== 'win32') {
const fs = this.req('fs');
let stat = fs.statSync(path);
if ((stat.mode & 0o0111) === 0) {
let mode = stat.mode | 0o0100;
logger.info(`chmod 0${mode.toString(8)} ${path}`);
fs.chmodSync(path, mode);
}
}
},
mkdir: function(dir) {
let fs = this.req('fs');
let path = this.req('path');