Better VirtualBox detection on Windows

Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Jeffrey Morgan 2015-10-06 07:22:23 -07:00
parent d9d2485408
commit d3a9622262
2 changed files with 9 additions and 3 deletions

View File

@ -313,7 +313,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['download-binary', 'newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']); grunt.registerTask('default', ['download-binary', 'newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
if (process.platform === 'win32') { if (process.platform === 'win32') {
grunt.registerTask('release', ['clean:release', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress', 'create-windows-installer', 'rename:installer']); grunt.registerTask('release', ['clean:release', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']);
} else { } else {
grunt.registerTask('release', ['clean:release', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:osx', 'copy:osx', 'shell:sign', 'shell:zip']); grunt.registerTask('release', ['clean:release', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:osx', 'copy:osx', 'shell:sign', 'shell:zip']);
} }

View File

@ -1,11 +1,16 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path';
import util from './Util'; import util from './Util';
import Promise from 'bluebird'; import Promise from 'bluebird';
var VirtualBox = { var VirtualBox = {
command: function () { command: function () {
if(util.isWindows()) { if(util.isWindows()) {
return 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe'; if (process.env.VBOX_MSI_INSTALL_PATH) {
return path.join(process.env.VBOX_MSI_INSTALL_PATH, 'VBoxManage.exe');
} else {
return path.join(process.env.VBOX_INSTALL_PATH, 'VBoxManage.exe');
}
} else { } else {
return '/Applications/VirtualBox.app/Contents/MacOS/VBoxManage'; return '/Applications/VirtualBox.app/Contents/MacOS/VBoxManage';
} }
@ -21,7 +26,8 @@ var VirtualBox = {
}, },
installed: function () { installed: function () {
if(util.isWindows()) { if(util.isWindows()) {
return fs.existsSync('C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe') && fs.existsSync('C:\\Program Files\\Oracle\\VirtualBox\\VirtualBox.exe'); return (process.env.VBOX_MSI_INSTALL_PATH && fs.existsSync(path.join(process.env.VBOX_MSI_INSTALL_PATH, 'VBoxManage.exe'))) ||
(process.env.VBOX_INSTALL_PATH && fs.existsSync(path.join(process.env.VBOX_INSTALL_PATH, 'VBoxManage.exe')));
} else { } else {
return fs.existsSync('/Applications/VirtualBox.app') && fs.existsSync('/Applications/VirtualBox.app/Contents/MacOS/VBoxManage'); return fs.existsSync('/Applications/VirtualBox.app') && fs.existsSync('/Applications/VirtualBox.app/Contents/MacOS/VBoxManage');
} }