VBOX: Add code to handle search path modification for Linux and Mac.

Something has changed on OS X that prevents /usr/local/bin from being in the default search path.  It is when launched from a terminal window, but not when BOINC launches vboxwrapper.  I think recent versions of VirtualBox changed where it stores VboxManage on install.  bbad0d9d recently addressed this in the CC.
This commit is contained in:
Rom Walton 2015-10-13 14:34:23 -04:00
parent b33025de6c
commit caf5255735
1 changed files with 12 additions and 2 deletions

View File

@ -86,8 +86,6 @@ int VBOX_VM::initialize() {
// Prep the environment so we can execute the vboxmanage application
//
// TODO: Fix for non-Windows environments if we ever find another platform
// where vboxmanage is not already in the search path
#ifdef _WIN32
if (!virtualbox_install_directory.empty())
{
@ -98,6 +96,18 @@ int VBOX_VM::initialize() {
vboxlog_msg("Failed to modify the search path.");
}
}
#else
old_path = getenv("PATH");
if(boinc_file_exists("/usr/local/bin/VboxManage")) {
new_path = "/usr/local/bin/:" + old_path;
}
if(boinc_file_exists("/usr/bin/VboxManage")) {
new_path = "/usr/bin/:" + old_path;
}
// putenv does not copy its input buffer, so we must use setenv
if (setenv("PATH", const_cast<char*>(new_path.c_str()), 1)) {
vboxlog_msg("Failed to modify the search path.");
}
#endif
// Determine the VirtualBox home directory. Overwrite as needed.