summaryrefslogtreecommitdiff
path: root/indra/llfilesystem
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llfilesystem')
-rw-r--r--indra/llfilesystem/lldir.cpp72
-rw-r--r--indra/llfilesystem/lldir_mac.cpp2
-rw-r--r--indra/llfilesystem/lldir_utils_objc.mm28
-rw-r--r--indra/llfilesystem/lldir_win32.cpp12
-rw-r--r--indra/llfilesystem/lldir_win32.h2
-rw-r--r--indra/llfilesystem/lldirguard.h7
-rw-r--r--indra/llfilesystem/lldiriterator.cpp10
-rw-r--r--indra/llfilesystem/lldiskcache.cpp39
-rw-r--r--indra/llfilesystem/llfilesystem.cpp7
-rw-r--r--indra/llfilesystem/tests/lldir_test.cpp106
10 files changed, 138 insertions, 147 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index e8e5d6538b..c6d8db8d48 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -44,16 +44,9 @@
#include "stringize.h"
#include "llstring.h"
#include <boost/filesystem.hpp>
-#include <boost/range/begin.hpp>
-#include <boost/range/end.hpp>
-#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
-#include <boost/ref.hpp>
#include <algorithm>
-using boost::assign::list_of;
-using boost::assign::map_list_of;
-
#if LL_WINDOWS
#include "lldir_win32.h"
LLDir_Win32 gDirUtil;
@@ -103,16 +96,17 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
//Returns a vector of fullpath filenames.
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path p(utf8str_to_utf16str(dirname));
+ boost::filesystem::path p(ll_convert<std::wstring>(dirname));
#else
boost::filesystem::path p(dirname);
#endif
std::vector<std::string> v;
- if (exists(p))
+ boost::system::error_code ec;
+ if (exists(p, ec) && !ec.failed())
{
- if (is_directory(p))
+ if (is_directory(p, ec) && !ec.failed())
{
boost::filesystem::directory_iterator end_iter;
for (boost::filesystem::directory_iterator dir_itr(p);
@@ -121,7 +115,11 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
{
if (boost::filesystem::is_regular_file(dir_itr->status()))
{
+#if LL_WINDOWS
+ v.push_back(utf16str_to_utf8str(dir_itr->path().filename().wstring()));
+#else
v.push_back(dir_itr->path().filename().string());
+#endif
}
}
}
@@ -196,7 +194,7 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
try
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- boost::filesystem::path dir_path(utf8str_to_utf16str(dir_name));
+ boost::filesystem::path dir_path(ll_convert<std::wstring>(dir_name));
#else
boost::filesystem::path dir_path(dir_name);
#endif
@@ -447,28 +445,28 @@ const std::string &LLDir::getUserName() const
static std::string ELLPathToString(ELLPath location)
{
typedef std::map<ELLPath, const char*> ELLPathMap;
-#define ENT(symbol) (symbol, #symbol)
- static const ELLPathMap sMap = map_list_of
- ENT(LL_PATH_NONE)
- ENT(LL_PATH_USER_SETTINGS)
- ENT(LL_PATH_APP_SETTINGS)
- ENT(LL_PATH_PER_SL_ACCOUNT) // returns/expands to blank string if we don't know the account name yet
- ENT(LL_PATH_CACHE)
- ENT(LL_PATH_CHARACTER)
- ENT(LL_PATH_HELP)
- ENT(LL_PATH_LOGS)
- ENT(LL_PATH_TEMP)
- ENT(LL_PATH_SKINS)
- ENT(LL_PATH_TOP_SKIN)
- ENT(LL_PATH_CHAT_LOGS)
- ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS)
- ENT(LL_PATH_USER_SKIN)
- ENT(LL_PATH_LOCAL_ASSETS)
- ENT(LL_PATH_EXECUTABLE)
- ENT(LL_PATH_DEFAULT_SKIN)
- ENT(LL_PATH_FONTS)
- ENT(LL_PATH_LAST)
- ;
+#define ENT(symbol) { symbol, #symbol }
+ static const ELLPathMap sMap = {
+ ENT(LL_PATH_NONE),
+ ENT(LL_PATH_USER_SETTINGS),
+ ENT(LL_PATH_APP_SETTINGS),
+ ENT(LL_PATH_PER_SL_ACCOUNT), // returns/expands to blank string if we don't know the account name yet
+ ENT(LL_PATH_CACHE),
+ ENT(LL_PATH_CHARACTER),
+ ENT(LL_PATH_HELP),
+ ENT(LL_PATH_LOGS),
+ ENT(LL_PATH_TEMP),
+ ENT(LL_PATH_SKINS),
+ ENT(LL_PATH_TOP_SKIN),
+ ENT(LL_PATH_CHAT_LOGS),
+ ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS),
+ ENT(LL_PATH_USER_SKIN),
+ ENT(LL_PATH_LOCAL_ASSETS),
+ ENT(LL_PATH_EXECUTABLE),
+ ENT(LL_PATH_DEFAULT_SKIN),
+ ENT(LL_PATH_FONTS),
+ ENT(LL_PATH_LAST),
+ };
#undef ENT
ELLPathMap::const_iterator found = sMap.find(location);
@@ -724,10 +722,10 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
// Recognize subdirs that have no localization.
- static const std::set<std::string> sUnlocalized = list_of
- ("") // top-level directory not localized
- ("textures") // textures not localized
- ;
+ static const std::set<std::string> sUnlocalized = {
+ "", // top-level directory not localized
+ "textures" // textures not localized
+ };
LL_DEBUGS("LLDir") << "subdir '" << subdir << "', filename '" << filename
<< "', constraint "
diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp
index b25c654e31..8b9bdd9853 100644
--- a/indra/llfilesystem/lldir_mac.cpp
+++ b/indra/llfilesystem/lldir_mac.cpp
@@ -149,7 +149,7 @@ LLDir_Mac::LLDir_Mac()
mWorkingDir = getCurPath();
- mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin";
+ mLLPluginDir = mAppRODataDir + mDirDelimiter + "SLPlugin.app" + mDirDelimiter + "Contents" + mDirDelimiter + "Frameworks";
}
}
diff --git a/indra/llfilesystem/lldir_utils_objc.mm b/indra/llfilesystem/lldir_utils_objc.mm
index 01fe9e1f2c..35513d5647 100644
--- a/indra/llfilesystem/lldir_utils_objc.mm
+++ b/indra/llfilesystem/lldir_utils_objc.mm
@@ -1,28 +1,28 @@
-/**
+/**
* @file lldir_utils_objc.mm
* @brief Cocoa implementation of directory utilities for macOS
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
- */
+ */
#if LL_DARWIN
//WARNING: This file CANNOT use standard linden includes due to conflicts between definitions of BOOL
@@ -39,18 +39,18 @@ std::string getSystemTempFolder()
tempDir = @"/tmp";
result = std::string([tempDir UTF8String]);
}
-
+
return result;
}
-//findSystemDirectory scoped exclusively to this file.
+//findSystemDirectory scoped exclusively to this file.
std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
NSSearchPathDomainMask domainMask)
{
std::string result;
@autoreleasepool {
NSString *path = nil;
-
+
// Search for the path
NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory,
domainMask,
@@ -60,10 +60,10 @@ std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
path = [paths objectAtIndex:0];
//HACK: Always attempt to create directory, ignore errors.
NSError *error = nil;
-
+
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
-
-
+
+
result = std::string([path UTF8String]);
}
}
@@ -88,7 +88,7 @@ std::string getSystemResourceFolder()
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
result = std::string([bundlePath UTF8String]);
}
-
+
return result;
}
@@ -102,7 +102,7 @@ std::string getSystemApplicationSupportFolder()
{
return findSystemDirectory (NSApplicationSupportDirectory,
NSUserDomainMask);
-
+
}
#endif // LL_DARWIN
diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp
index a607c70b44..58c080c982 100644
--- a/indra/llfilesystem/lldir_win32.cpp
+++ b/indra/llfilesystem/lldir_win32.cpp
@@ -172,7 +172,7 @@ LLDir_Win32::LLDir_Win32()
{
w_str[wcslen(w_str)-1] = '\0'; /* Flawfinder: ignore */ // remove trailing slash
}
- mTempDir = utf16str_to_utf8str(llutf16string(w_str));
+ mTempDir = ll_convert<std::string>(std::wstring(w_str));
if (mOSUserDir.empty())
{
@@ -225,14 +225,14 @@ LLDir_Win32::LLDir_Win32()
// Set working directory, for LLDir::getWorkingDir()
GetCurrentDirectory(MAX_PATH, w_str);
- mWorkingDir = utf16str_to_utf8str(llutf16string(w_str));
+ mWorkingDir = ll_convert<std::string>(std::wstring(w_str));
// Set the executable directory
S32 size = GetModuleFileName(NULL, w_str, MAX_PATH);
if (size)
{
w_str[size] = '\0';
- mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str));
+ mExecutablePathAndName = ll_convert<std::string>(std::wstring(w_str));
auto path_end = mExecutablePathAndName.find_last_of('\\');
if (path_end != std::string::npos)
{
@@ -347,8 +347,8 @@ U32 LLDir_Win32::countFilesInDir(const std::string &dirname, const std::string &
WIN32_FIND_DATA FileData;
- llutf16string pathname = utf8str_to_utf16str(dirname);
- pathname += utf8str_to_utf16str(mask);
+ std::wstring pathname = ll_convert<std::wstring>(dirname);
+ pathname += ll_convert<std::wstring>(mask);
if ((count_search_h = FindFirstFile(pathname.c_str(), &FileData)) != INVALID_HANDLE_VALUE)
{
@@ -370,7 +370,7 @@ std::string LLDir_Win32::getCurPath()
WCHAR w_str[MAX_PATH];
GetCurrentDirectory(MAX_PATH, w_str);
- return utf16str_to_utf8str(llutf16string(w_str));
+ return ll_convert<std::string>(std::wstring(w_str));
}
diff --git a/indra/llfilesystem/lldir_win32.h b/indra/llfilesystem/lldir_win32.h
index ab2726f1a0..21a3f1213b 100644
--- a/indra/llfilesystem/lldir_win32.h
+++ b/indra/llfilesystem/lldir_win32.h
@@ -51,7 +51,7 @@ public:
private:
void* mDirSearch_h{ nullptr };
- llutf16string mCurrentDir;
+ std::wstring mCurrentDir;
};
#endif // LL_LLDIR_WIN32_H
diff --git a/indra/llfilesystem/lldirguard.h b/indra/llfilesystem/lldirguard.h
index fcb179bbc8..c6ce13efb4 100644
--- a/indra/llfilesystem/lldirguard.h
+++ b/indra/llfilesystem/lldirguard.h
@@ -31,6 +31,9 @@
#include "llerror.h"
#if LL_WINDOWS
+
+#include "llwin32headers.h"
+
class LLDirectoryGuard
{
public:
@@ -46,8 +49,8 @@ public:
(wcsncmp(mOrigDir,mFinalDir,mOrigDirLen)!=0))
{
// Dir has changed
- std::string mOrigDirUtf8 = utf16str_to_utf8str(llutf16string(mOrigDir));
- std::string mFinalDirUtf8 = utf16str_to_utf8str(llutf16string(mFinalDir));
+ std::string mOrigDirUtf8 = ll_convert<std::string>(std::wstring(mOrigDir));
+ std::string mFinalDirUtf8 = ll_convert<std::string>(std::wstring(mFinalDir));
LL_INFOS() << "Resetting working dir from " << mFinalDirUtf8 << " to " << mOrigDirUtf8 << LL_ENDL;
SetCurrentDirectory(mOrigDir);
}
diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp
index 61f768c512..a6eb4adf7f 100644
--- a/indra/llfilesystem/lldiriterator.cpp
+++ b/indra/llfilesystem/lldiriterator.cpp
@@ -52,7 +52,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
: mIsValid(false)
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
- fs::path dir_path(utf8str_to_utf16str(dirname));
+ fs::path dir_path(ll_convert<std::wstring>(dirname));
#else
fs::path dir_path(dirname);
#endif
@@ -72,7 +72,11 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
if (!is_dir)
{
+#if LL_WINDOWS
+ LL_WARNS() << "Invalid path: \"" << utf16str_to_utf8str(dir_path.wstring()) << "\"" << LL_ENDL;
+#else
LL_WARNS() << "Invalid path: \"" << dir_path.string() << "\"" << LL_ENDL;
+#endif
return;
}
@@ -130,7 +134,11 @@ bool LLDirIterator::Impl::next(std::string &fname)
while (mIter != end_itr && !found)
{
boost::smatch match;
+#if LL_WINDOWS
+ std::string name = utf16str_to_utf8str(mIter->path().filename().wstring());
+#else
std::string name = mIter->path().filename().string();
+#endif
found = ll_regex_match(name, match, mFilterExp);
if (found)
{
diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index 49904911a9..82e9e18918 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -103,7 +103,7 @@ void LLDiskCache::purge()
std::vector<file_info_t> file_info;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(sCacheDir));
+ std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
@@ -114,14 +114,22 @@ void LLDiskCache::purge()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (ec.failed())
{
continue;
}
+#if LL_WINDOWS
+ const std::string file_path = utf16str_to_utf8str((*iter).path().wstring());
+#else
const std::string file_path = (*iter).path().string();
+#endif
const std::time_t file_time = boost::filesystem::last_write_time(*iter, ec);
if (ec.failed())
{
@@ -159,10 +167,16 @@ void LLDiskCache::purge()
}
if (should_remove)
{
+#if LL_WINDOWS
+ boost::filesystem::remove(utf8str_to_utf16str(entry.second.second), ec);
+#else
boost::filesystem::remove(entry.second.second, ec);
+#endif
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -226,7 +240,7 @@ void LLDiskCache::clearCache()
*/
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(sCacheDir));
+ std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
@@ -237,12 +251,18 @@ void LLDiskCache::clearCache()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -259,7 +279,7 @@ void LLDiskCache::removeOldVFSFiles()
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring cache_path(utf8str_to_utf16str(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")));
+ std::wstring cache_path(ll_convert<std::wstring>(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")));
#else
std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""));
#endif
@@ -270,13 +290,20 @@ void LLDiskCache::removeOldVFSFiles()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if ((utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FORMAT) != std::string::npos) ||
+ (utf16str_to_utf8str((*iter).path().wstring()).find(DB_FORMAT) != std::string::npos))
+#else
if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) ||
((*iter).path().string().find(DB_FORMAT) != std::string::npos))
+#endif
{
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -300,7 +327,7 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
*/
boost::system::error_code ec;
#if LL_WINDOWS
- std::wstring dir_path(utf8str_to_utf16str(dir));
+ std::wstring dir_path(ll_convert<std::wstring>(dir));
#else
std::string dir_path(dir);
#endif
@@ -311,7 +338,11 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (!ec.failed())
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index c8ce9531c2..541266af4f 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -103,9 +103,6 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp
const std::string old_filename = LLDiskCache::metaDataToFilepath(old_file_id, old_file_type);
const std::string new_filename = LLDiskCache::metaDataToFilepath(new_file_id, new_file_type);
- // Rename needs the new file to not exist.
- LLFileSystem::removeFile(new_file_id, new_file_type, ENOENT);
-
if (LLFile::rename(old_filename, new_filename) != 0)
{
// We would like to return false here indicating the operation
@@ -316,7 +313,7 @@ void LLFileSystem::updateFileAccessTime(const std::string& file_path)
boost::system::error_code ec;
#if LL_WINDOWS
// file last write time
- const std::time_t last_write_time = boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), ec);
+ const std::time_t last_write_time = boost::filesystem::last_write_time(ll_convert<std::wstring>(file_path), ec);
if (ec.failed())
{
LL_WARNS() << "Failed to read last write time for cache file " << file_path << ": " << ec.message() << LL_ENDL;
@@ -330,7 +327,7 @@ void LLFileSystem::updateFileAccessTime(const std::string& file_path)
// before the last one
if (delta_time > time_threshold)
{
- boost::filesystem::last_write_time(utf8str_to_utf16str(file_path), cur_time, ec);
+ boost::filesystem::last_write_time(ll_convert<std::wstring>(file_path), cur_time, ec);
}
#else
// file last write time
diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp
index 6e191ad096..13db6fad80 100644
--- a/indra/llfilesystem/tests/lldir_test.cpp
+++ b/indra/llfilesystem/tests/lldir_test.cpp
@@ -34,19 +34,6 @@
#include "../test/lltut.h"
#include "stringize.h"
-#include <boost/assign/list_of.hpp>
-
-using boost::assign::list_of;
-
-// We use ensure_equals(..., vec(list_of(...))) not because it's functionally
-// required, but because ensure_equals() knows how to format a StringVec.
-// Turns out that when ensure_equals() displays a test failure with just
-// list_of("string")("another"), you see 'stringanother' vs. '("string",
-// "another")'.
-StringVec vec(const StringVec& v)
-{
- return v;
-}
// For some tests, use a dummy LLDir that uses memory data instead of touching
// the filesystem
@@ -435,7 +422,7 @@ namespace tut
for (counter=0, foundUnused=false; !foundUnused; counter++ )
{
char counterStr[3];
- sprintf(counterStr, "%02d", counter);
+ snprintf(counterStr, sizeof(counterStr), "%02d", counter);
uniqueDir = dirbase + counterStr;
foundUnused = ! ( LLFile::isdir(uniqueDir) || LLFile::isfile(uniqueDir) );
}
@@ -590,20 +577,18 @@ namespace tut
// top-level directory of a skin isn't localized
ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS),
- vec(list_of("install/skins/default/colors.xml")
- ("user/skins/default/colors.xml")));
+ StringVec{ "install/skins/default/colors.xml", "user/skins/default/colors.xml" });
// We should not have needed to check for skins/default/en. We should
// just "know" that SKINBASE is not localized.
lldir.ensure_not_checked("install/skins/default/en");
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"),
- vec(list_of("install/skins/default/textures/only_default.jpeg")));
+ StringVec{ "install/skins/default/textures/only_default.jpeg" });
// Nor should we have needed to check skins/default/textures/en
// because textures is known not to be localized.
lldir.ensure_not_checked("install/skins/default/textures/en");
- StringVec expected(vec(list_of("install/skins/default/xui/en/strings.xml")
- ("user/skins/default/xui/en/strings.xml")));
+ StringVec expected(StringVec{ "install/skins/default/xui/en/strings.xml", "user/skins/default/xui/en/strings.xml" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
expected);
// The first time, we had to probe to find out whether xui was localized.
@@ -616,23 +601,19 @@ namespace tut
lldir.ensure_not_checked("install/skins/default/xui/en");
// localized subdir with "en-us" instead of "en"
- ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
- vec(list_of("install/skins/default/html/en-us/welcome.html")));
+ ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
lldir.ensure_checked("install/skins/default/html/en");
lldir.ensure_checked("install/skins/default/html/en-us");
lldir.clear_checked();
- ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
- vec(list_of("install/skins/default/html/en-us/welcome.html")));
+ ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
lldir.ensure_not_checked("install/skins/default/html/en");
lldir.ensure_not_checked("install/skins/default/html/en-us");
- ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"),
- vec(list_of("install/skins/default/future/somefile.txt")));
+ ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" });
// Test probing for an unrecognized unlocalized future subdir.
lldir.ensure_checked("install/skins/default/future/en");
lldir.clear_checked();
- ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"),
- vec(list_of("install/skins/default/future/somefile.txt")));
+ ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" });
// Second time it should remember that future is unlocalized.
lldir.ensure_not_checked("install/skins/default/future/en");
@@ -643,8 +624,7 @@ namespace tut
// make the default localization be "en" and allow "en-gb" (or
// whatever) localizations, which would work much more the way you'd
// expect.
- ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
- vec(list_of("install/skins/default/html/en-us/welcome.html")));
+ ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" });
/*------------------------ "default", "fr" -------------------------*/
// We start being able to distinguish localized subdirs from
@@ -654,100 +634,74 @@ namespace tut
// pass merge=true to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
- vec(list_of
- ("install/skins/default/xui/en/strings.xml")
- ("install/skins/default/xui/fr/strings.xml")
- ("user/skins/default/xui/en/strings.xml")
- ("user/skins/default/xui/fr/strings.xml")));
+ StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml",
+ "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" });
// pass (or default) merge=false to request only most specific skin
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
- vec(list_of
- ("user/skins/default/xui/en/strings.xml")
- ("user/skins/default/xui/fr/strings.xml")));
+ StringVec{ "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" });
// Our dummy floater.xml has a user localization (for "fr") but no
// English override. This is a case in which CURRENT_SKIN nonetheless
// returns paths from two different skins.
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "floater.xml"),
- vec(list_of
- ("install/skins/default/xui/en/floater.xml")
- ("user/skins/default/xui/fr/floater.xml")));
+ StringVec{ "install/skins/default/xui/en/floater.xml", "user/skins/default/xui/fr/floater.xml" });
// Our dummy newfile.xml has an English override but no user
// localization. This is another case in which CURRENT_SKIN
// nonetheless returns paths from two different skins.
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "newfile.xml"),
- vec(list_of
- ("user/skins/default/xui/en/newfile.xml")
- ("install/skins/default/xui/fr/newfile.xml")));
+ StringVec{ "user/skins/default/xui/en/newfile.xml", "install/skins/default/xui/fr/newfile.xml" });
ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"),
- vec(list_of
- ("install/skins/default/html/en-us/welcome.html")
- ("install/skins/default/html/fr/welcome.html")));
+ StringVec{ "install/skins/default/html/en-us/welcome.html", "install/skins/default/html/fr/welcome.html" });
/*------------------------ "default", "zh" -------------------------*/
lldir.setSkinFolder("default", "zh");
// Because strings.xml has only a "fr" override but no "zh" override
// in any skin, the most localized version we can find is "en".
- ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
- vec(list_of("user/skins/default/xui/en/strings.xml")));
+ ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/default/xui/en/strings.xml" });
/*------------------------- "steam", "en" --------------------------*/
lldir.setSkinFolder("steam", "en");
ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS),
- vec(list_of
- ("install/skins/default/colors.xml")
- ("install/skins/steam/colors.xml")
- ("user/skins/default/colors.xml")
- ("user/skins/steam/colors.xml")));
+ StringVec{ "install/skins/default/colors.xml", "install/skins/steam/colors.xml", "user/skins/default/colors.xml",
+ "user/skins/steam/colors.xml" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"),
- vec(list_of("install/skins/default/textures/only_default.jpeg")));
+ StringVec{ "install/skins/default/textures/only_default.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_steam.jpeg"),
- vec(list_of("install/skins/steam/textures/only_steam.jpeg")));
+ StringVec{ "install/skins/steam/textures/only_steam.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_default.jpeg"),
- vec(list_of("user/skins/default/textures/only_user_default.jpeg")));
+ StringVec{ "user/skins/default/textures/only_user_default.jpeg" });
ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_steam.jpeg"),
- vec(list_of("user/skins/steam/textures/only_user_steam.jpeg")));
+ StringVec{ "user/skins/steam/textures/only_user_steam.jpeg" });
// CURRENT_SKIN
- ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
- vec(list_of("user/skins/steam/xui/en/strings.xml")));
+ ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/steam/xui/en/strings.xml" });
// pass constraint=ALL_SKINS to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
- vec(list_of
- ("install/skins/default/xui/en/strings.xml")
- ("install/skins/steam/xui/en/strings.xml")
- ("user/skins/default/xui/en/strings.xml")
- ("user/skins/steam/xui/en/strings.xml")));
+ StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/steam/xui/en/strings.xml",
+ "user/skins/default/xui/en/strings.xml", "user/skins/steam/xui/en/strings.xml" });
/*------------------------- "steam", "fr" --------------------------*/
lldir.setSkinFolder("steam", "fr");
// pass CURRENT_SKIN to request only the most specialized files
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"),
- vec(list_of
- ("user/skins/steam/xui/en/strings.xml")
- ("user/skins/steam/xui/fr/strings.xml")));
+ StringVec{ "user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" });
// pass ALL_SKINS to request this filename in all relevant skins
ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS),
- vec(list_of
- ("install/skins/default/xui/en/strings.xml")
- ("install/skins/default/xui/fr/strings.xml")
- ("install/skins/steam/xui/en/strings.xml")
- ("install/skins/steam/xui/fr/strings.xml")
- ("user/skins/default/xui/en/strings.xml")
- ("user/skins/default/xui/fr/strings.xml")
- ("user/skins/steam/xui/en/strings.xml")
- ("user/skins/steam/xui/fr/strings.xml")));
+ StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml",
+ "install/skins/steam/xui/en/strings.xml", "install/skins/steam/xui/fr/strings.xml",
+ "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml",
+ "user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" });
}
template<> template<>