Skip to content

Commit

Permalink
VBOX: Add code to handle search path modification for Linux and Mac.
Browse files Browse the repository at this point in the history
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.  bbad0d9 recently addressed this in the CC.
  • Loading branch information
romw committed Oct 13, 2015
1 parent b33025d commit caf5255
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions samples/vboxwrapper/vbox_vboxmanage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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.
Expand Down

0 comments on commit caf5255

Please sign in to comment.