summaryrefslogtreecommitdiff
path: root/indra/llfilesystem
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llfilesystem')
-rw-r--r--indra/llfilesystem/lldir.cpp4
-rw-r--r--indra/llfilesystem/lldiriterator.cpp8
-rw-r--r--indra/llfilesystem/lldiskcache.cpp31
3 files changed, 43 insertions, 0 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index e8e5d6538b..d12080aafa 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -121,7 +121,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
}
}
}
diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp
index 61f768c512..cd99c79357 100644
--- a/indra/llfilesystem/lldiriterator.cpp
+++ b/indra/llfilesystem/lldiriterator.cpp
@@ -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..d9b223fb49 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -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
}
}
}
@@ -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
}
}
}
@@ -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
}
}
}
@@ -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())