Skip to content

Commit

Permalink
use the 8.3 filename for R_HOME on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jul 28, 2011
1 parent 4be2771 commit 1e9a7f6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/cpp/desktop/DesktopWin32DetectRHome.cpp
Expand Up @@ -37,7 +37,27 @@ bool prepareEnvironment(Options &options)
if (!rVersion.isValid())
return false;

system::setenv("R_HOME", rVersion.homeDir().toStdString());

// get the short path version of the home dir
std::string homePath =
QDir::toNativeSeparators(rVersion.homeDir()).toStdString();
DWORD len = ::GetShortPathName(homePath.c_str(), NULL, 0);
std::vector<TCHAR> buffer(len, 0);
if (::GetShortPathName(homePath.c_str(), &(buffer[0]), len) != 0)
{
// copy path to string and assign it we got one
std::string shortHomePath(&(buffer[0]));
if (!shortHomePath.empty())
homePath = shortHomePath;
}
else
{
LOG_ERROR(systemError(::GetLastError(), ERROR_LOCATION));
}


// set R_HOME
system::setenv("R_HOME", homePath);

std::string path =
QDir::toNativeSeparators(rVersion.binDir()).toStdString() + ";" +
Expand Down

0 comments on commit 1e9a7f6

Please sign in to comment.