Portability Mode!

Just add --portable to the shortcut
or use the provided shortcut as a template,
though it's likely the provided shortcut will not work on other computers, because the drive letter will change
This commit is contained in:
Inusaito Sayori
2014-06-09 00:00:43 -04:00
parent fb7751360c
commit e46fc0a805
5 changed files with 54 additions and 0 deletions

View File

@@ -710,6 +710,33 @@ void LLDir::setLindenUserDir(const std::string &grid, const std::string &first,
dumpCurrentDirectories();
}
void LLDir::makePortable()
{
std::string dir = mExecutableDir;
dir.erase(dir.rfind(mDirDelimiter)); // Go one level up
dir += mDirDelimiter + "portable_viewer";
if (LLFile::mkdir(dir) == -1)
{
if (errno != EEXIST)
{
llwarns << "Couldn't create portable_viewer directory." << llendl;
return; // Failed, don't mess anything up.
}
}
mOSUserDir = dir + mDirDelimiter + "settings";
mOSCacheDir = dir + mDirDelimiter + "cache";
if (LLFile::mkdir(mOSUserDir) == -1 || LLFile::mkdir(mOSCacheDir) == -1)
{
if (errno != EEXIST)
{
llwarns << "Couldn't create portable_viewer cache and settings directories." << llendl;
return; // Failed, don't mess up the existing initialization.
}
}
mDefaultCacheDir = buildSLOSCacheDir();
initAppDirs(mAppName); // This is kinda lazy, but it's probably the quickest, most uniform way.
}
void LLDir::setChatLogsDir(const std::string &path)
{
if (!path.empty() )

View File

@@ -133,6 +133,7 @@ class LLDir
static std::string getForbiddenFileChars();
void setDumpDir( const std::string& path );
void makePortable();
virtual void setChatLogsDir(const std::string &path); // Set the chat logs dir to this user's dir
virtual void setPerAccountChatLogsDir(const std::string &grid, const std::string &first, const std::string &last); // Set the per user chat log directory.
virtual void setLindenUserDir(const std::string& grid, const std::string& first, const std::string& last); // Set the linden user dir to this user's dir