- VBOX: Don't redirect VirtualBox to a different directory structure for

the root configuration file when the client is NOT in sandbox mode.
        Doing so could cause confusion if the volunteer uses VirtualBox for
        any of their own work.  If BOINC started up first it would have appeared
        that their own VM's no longer existed.
        
    samples/vboxwrapper/
        vbox.cpp

svn path=/trunk/boinc/; revision=24449
This commit is contained in:
Rom Walton 2011-10-21 16:34:45 +00:00
parent bcbea6fdcf
commit dbbd2a3ff9
2 changed files with 30 additions and 18 deletions

View File

@ -7608,3 +7608,13 @@ Charlie 21 Oct 2011
sg_BoincSimpleFrame.cpp,.h
sg_DlgMessages.cpp,.h
sg_DlgPreferences.cpp,.h
Rom 21 Oct 2011
- VBOX: Don't redirect VirtualBox to a different directory structure for
the root configuration file when the client is NOT in sandbox mode.
Doing so could cause confusion if the volunteer uses VirtualBox for
any of their own work. If BOINC started up first it would have appeared
that their own VM's no longer existed.
samples/vboxwrapper/
vbox.cpp

View File

@ -416,29 +416,31 @@ int VBOX_VM::initialize() {
// Set the location in which the VirtualBox Configuration files can be
// stored for this instance.
//
virtualbox_user_home = aid.project_dir;
virtualbox_user_home += "/../virtualbox";
if (aid.using_sandbox) {
virtualbox_user_home = aid.project_dir;
virtualbox_user_home += "/../virtualbox";
if (!boinc_file_exists(virtualbox_user_home.c_str())) boinc_mkdir(virtualbox_user_home.c_str());
if (!boinc_file_exists(virtualbox_user_home.c_str())) boinc_mkdir(virtualbox_user_home.c_str());
#ifdef _WIN32
if (!SetEnvironmentVariable("VBOX_USER_HOME", const_cast<char*>(virtualbox_user_home.c_str()))) {
fprintf(
stderr,
"%s Failed to modify the search path.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
}
if (!SetEnvironmentVariable("VBOX_USER_HOME", const_cast<char*>(virtualbox_user_home.c_str()))) {
fprintf(
stderr,
"%s Failed to modify the search path.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
}
#else
// putenv does not copy its input buffer, so we must use setenv
if (setenv("VBOX_USER_HOME", const_cast<char*>(virtualbox_user_home.c_str()), 1)) {
fprintf(
stderr,
"%s Failed to modify the VBOX_USER_HOME path.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
}
// putenv does not copy its input buffer, so we must use setenv
if (setenv("VBOX_USER_HOME", const_cast<char*>(virtualbox_user_home.c_str()), 1)) {
fprintf(
stderr,
"%s Failed to modify the VBOX_USER_HOME path.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
}
#endif
}
return 0;
}