mirror of https://github.com/BOINC/boinc.git
client: VirtualBox now installs VboxManage to /usr/local/bin. Make detection of VirtualBox work again.
This commit is contained in:
parent
fcb359d2ee
commit
bbad0d9d9d
|
@ -1224,33 +1224,47 @@ bool isDualGPUMacBook() {
|
||||||
|
|
||||||
// see if Virtualbox is installed
|
// see if Virtualbox is installed
|
||||||
//
|
//
|
||||||
|
static const struct dir_vbox_locations {
|
||||||
|
const char *dir;
|
||||||
|
} vbox_locations[] = {
|
||||||
|
{ "/usr/bin/VboxManage" },
|
||||||
|
{ "/usr/local/bin/VboxManage" },
|
||||||
|
// add other ifdefs here as necessary.
|
||||||
|
{ NULL },
|
||||||
|
};
|
||||||
|
|
||||||
int HOST_INFO::get_virtualbox_version() {
|
int HOST_INFO::get_virtualbox_version() {
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
char cmd [MAXPATHLEN+35];
|
char cmd [MAXPATHLEN+35];
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
int i = 0;
|
||||||
FILE* fd;
|
FILE* fd;
|
||||||
|
|
||||||
safe_strcpy(path, "/usr/bin/VBoxManage");
|
do {
|
||||||
|
safe_strcpy(path, vbox_locations[i].dir);
|
||||||
|
|
||||||
if (boinc_file_exists(path)) {
|
if (boinc_file_exists(path)) {
|
||||||
if (access(path, X_OK)) {
|
if (access(path, X_OK)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
safe_strcpy(cmd, path);
|
safe_strcpy(cmd, path);
|
||||||
safe_strcat(cmd, " --version");
|
safe_strcat(cmd, " --version");
|
||||||
fd = popen(cmd, "r");
|
fd = popen(cmd, "r");
|
||||||
if (fd) {
|
if (fd) {
|
||||||
if (fgets(buf, sizeof(buf), fd)) {
|
if (fgets(buf, sizeof(buf), fd)) {
|
||||||
strip_whitespace(buf);
|
strip_whitespace(buf);
|
||||||
int n, a,b,c;
|
int n, a,b,c;
|
||||||
n = sscanf(buf, "%d.%d.%d", &a, &b, &c);
|
n = sscanf(buf, "%d.%d.%d", &a, &b, &c);
|
||||||
if (n == 3) {
|
if (n == 3) {
|
||||||
strcpy(virtualbox_version, buf);
|
strcpy(virtualbox_version, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pclose(fd);
|
pclose(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
} while (vbox_locations[i].dir != NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue