diff options
Diffstat (limited to 'indra/llfilesystem/lldir.cpp')
| -rw-r--r-- | indra/llfilesystem/lldir.cpp | 72 |
1 files changed, 35 insertions, 37 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 " |
