Updated logic and removed pref

Signed-off-by: French Ben <me+git@frenchben.com>
This commit is contained in:
French Ben 2016-03-02 17:36:40 -08:00
parent dfdf9e326e
commit d1a49abcf6
2 changed files with 21 additions and 17 deletions

View File

@ -101,20 +101,18 @@ var Setup = React.createClass({
<button className="btn btn-action" onClick={this.handleLinuxDockerInstall}>Install Docker</button> <button className="btn btn-action" onClick={this.handleLinuxDockerInstall}>Install Docker</button>
); );
} }
} else if (util.isNative()) {
deleteVmAndRetry = (
<button className="btn btn-action" onClick={this.handleUseVbox}>Use VirtualBox</button>
);
} else if (this.state.started) {
deleteVmAndRetry = (
<button className="btn btn-action" onClick={this.handleErrorRemoveRetry}>Delete VM &amp; Retry Setup</button>
);
} else { } else {
if (util.isNative()) { deleteVmAndRetry = (
deleteVmAndRetry = ( <button className="btn btn-action" onClick={this.handleToolBox}>Get Toolbox</button>
<button className="btn btn-action" onClick={this.handleUseVbox}>Use VirtualBox</button> );
);
} else if (this.state.started) {
deleteVmAndRetry = (
<button className="btn btn-action" onClick={this.handleErrorRemoveRetry}>Delete VM &amp; Retry Setup</button>
);
} else {
deleteVmAndRetry = (
<button className="btn btn-action" onClick={this.handleToolBox}>Get Toolbox</button>
);
}
} }
return ( return (
<div className="setup"> <div className="setup">

View File

@ -38,13 +38,19 @@ module.exports = {
return process.platform === 'linux'; return process.platform === 'linux';
}, },
isNative: function () { isNative: function () {
let native = JSON.parse(localStorage.getItem('settings.useNative')); // let native = JSON.parse(localStorage.getItem('settings.useNative'));
let native = null;
if (native === null) { if (native === null) {
try { try {
let stats = fs.statSync('/var/run/docker.sock'); // Check if file exists
fs.statSync('/var/run/docker.sock');
native = true; native = true;
} catch(e){ } catch (e) {
native = false; if (this.isLinux()) {
native = true;
} else {
native = false;
}
} }
} }
return native; return native;