From caf5255735bb03a704c653aeff6d49080d2bf68c Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 13 Oct 2015 14:34:23 -0400 Subject: [PATCH] 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. --- samples/vboxwrapper/vbox_vboxmanage.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index 89a96dbceb..8a775db260 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -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(new_path.c_str()), 1)) { + vboxlog_msg("Failed to modify the search path."); + } #endif // Determine the VirtualBox home directory. Overwrite as needed.