QAR-1141 svn merge -r107086:107087 svn+ssh://svn.lindenlab.com/svn/user/cg/llvfs-fix-2

master
Christian Goetze 2009-01-06 23:30:52 +00:00
parent 36645d1c52
commit b96d890c44
3 changed files with 47 additions and 15 deletions

View File

@ -215,22 +215,12 @@ const std::string LLDir::getCacheDir(bool get_default) const
{
if (mCacheDir.empty() || get_default)
{
std::string res;
if (getOSCacheDir().empty())
{
if (getOSUserAppDir().empty())
{
res = "data";
}
else
{
res = getOSUserAppDir() + mDirDelimiter + "cache";
}
}
else
{
res = getOSCacheDir() + mDirDelimiter + "SecondLife";
if (!mDefaultCacheDir.empty())
{ // Set at startup - can't set here due to const API
return mDefaultCacheDir;
}
std::string res = buildSLOSCacheDir();
return res;
}
else
@ -239,6 +229,30 @@ const std::string LLDir::getCacheDir(bool get_default) const
}
}
// Return the default cache directory
std::string LLDir::buildSLOSCacheDir() const
{
std::string res;
if (getOSCacheDir().empty())
{
if (getOSUserAppDir().empty())
{
res = "data";
}
else
{
res = getOSUserAppDir() + mDirDelimiter + "cache";
}
}
else
{
res = getOSCacheDir() + mDirDelimiter + "SecondLife";
}
return res;
}
const std::string &LLDir::getOSCacheDir() const
{
return mOSCacheDir;

View File

@ -126,6 +126,9 @@ class LLDir
virtual void dumpCurrentDirectories();
// Utility routine
std::string buildSLOSCacheDir() const;
protected:
std::string mAppName; // install directory under progams/ ie "SecondLife"
std::string mExecutablePathAndName; // full path + Filename of .exe
@ -141,6 +144,7 @@ protected:
std::string mCAFile; // Location of the TLS certificate authority PEM file.
std::string mTempDir;
std::string mCacheDir; // cache directory as set by user preference
std::string mDefaultCacheDir; // default cache diretory
std::string mOSCacheDir; // operating system cache dir
std::string mDirDelimiter;
std::string mSkinDir; // Location for current skin info.

View File

@ -128,6 +128,20 @@ LLDir_Win32::LLDir_Win32()
mAppRODataDir = getCurPath();
else
mAppRODataDir = mExecutableDir;
// Build the default cache directory
mDefaultCacheDir = buildSLOSCacheDir();
// Make sure it exists
int res = LLFile::mkdir(mDefaultCacheDir);
if (res == -1)
{
if (errno != EEXIST)
{
llwarns << "Couldn't create LL_PATH_CACHE dir " << mDefaultCacheDir << llendl;
}
}
}
LLDir_Win32::~LLDir_Win32()