Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,11 @@
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>243709fbbb58a91dca81d16df650e9c6ff910d0d</string>
<string>da318f0813e4126d90e35b22a8dce235e908707a</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118207</string>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/208381808</string>
</map>
<key>name</key>
<string>darwin64</string>
Expand All @@ -1056,11 +1056,11 @@
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>7fd0a7ee71a4e76b49e31b75f8622852324d58a4</string>
<string>1ba58cf884726dfdf02a7662d52f1befe3f16d44</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118208</string>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/208381812</string>
</map>
<key>name</key>
<string>linux64</string>
Expand All @@ -1072,15 +1072,31 @@
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>8c475dd9616c7e0e3029cc38aefc1e0ab34d2e73</string>
<string>e8d693089b9ecd15b6644f13ada7ae7c317944df</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118209</string>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/208381814</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
<key>linux</key>
<map>
<key>archive</key>
<map>
<key>creds</key>
<string>github</string>
<key>hash</key>
<string>85e294becce8b2ac5d2e5e052b0e21ff865d1108</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/208381806</string>
</map>
<key>name</key>
<string>linux</string>
</map>
</map>
<key>license</key>
<string>Kakadu</string>
Expand All @@ -1089,7 +1105,7 @@
<key>copyright</key>
<string>Kakadu software</string>
<key>version</key>
<string>8.4.1.11540433907</string>
<string>8.4.1.11976899217</string>
<key>name</key>
<string>kdu</string>
<key>description</key>
Expand Down
32 changes: 16 additions & 16 deletions indra/llfilesystem/lldir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "lldiriterator.h"
#include "stringize.h"
#include "llstring.h"
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/assign/list_of.hpp>
Expand Down Expand Up @@ -103,24 +103,24 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
//Returns a vector of fullpath filenames.

#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
std::filesystem::path p(ll_convert<std::wstring>(dirname));
boost::filesystem::path p(ll_convert<std::wstring>(dirname));
#else
std::filesystem::path p(dirname);
boost::filesystem::path p(dirname);
#endif

std::vector<std::string> v;

std::error_code ec;
if (std::filesystem::exists(p, ec) && ec.value() == 0)
boost::system::error_code ec;
if (exists(p, ec) && !ec.failed())
{
if (is_directory(p, ec) && ec.value() == 0)
if (is_directory(p, ec) && !ec.failed())
{
std::filesystem::directory_iterator end_iter;
for (std::filesystem::directory_iterator dir_itr(p);
boost::filesystem::directory_iterator end_iter;
for (boost::filesystem::directory_iterator dir_itr(p);
dir_itr != end_iter;
++dir_itr)
{
if (std::filesystem::is_regular_file(dir_itr->status()))
if (boost::filesystem::is_regular_file(dir_itr->status()))
{
v.push_back(dir_itr->path().filename().string());
}
Expand Down Expand Up @@ -197,24 +197,24 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
try
{
#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
std::filesystem::path dir_path(ll_convert<std::wstring>(dir_name));
boost::filesystem::path dir_path(ll_convert<std::wstring>(dir_name));
#else
std::filesystem::path dir_path(dir_name);
boost::filesystem::path dir_path(dir_name);
#endif

if (std::filesystem::exists(dir_path))
if (boost::filesystem::exists(dir_path))
{
if (!std::filesystem::is_empty(dir_path))
if (!boost::filesystem::is_empty(dir_path))
{ // Directory has content
num_deleted = (U32)std::filesystem::remove_all(dir_path);
num_deleted = (U32)boost::filesystem::remove_all(dir_path);
}
else
{ // Directory is empty
std::filesystem::remove(dir_path);
boost::filesystem::remove(dir_path);
}
}
}
catch (std::filesystem::filesystem_error &er)
catch (boost::filesystem::filesystem_error &er)
{
LL_WARNS() << "Failed to delete " << dir_name << " with error " << er.code().message() << LL_ENDL;
}
Expand Down
4 changes: 2 additions & 2 deletions indra/llfilesystem/lldiriterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

#include "fix_macros.h"
#include "llregex.h"
#include <filesystem>
#include <boost/filesystem.hpp>

namespace fs = std::filesystem;
namespace fs = boost::filesystem;

static std::string glob_to_regex(const std::string& glob);

Expand Down
70 changes: 35 additions & 35 deletions indra/llfilesystem/lldiskcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "llapp.h"
#include "llassettype.h"
#include "lldir.h"
#include <filesystem>
#include <boost/filesystem.hpp>
#include <chrono>

#include "lldiskcache.h"
Expand Down Expand Up @@ -83,7 +83,7 @@ LLDiskCache::LLDiskCache(const std::string& cache_dir,
// garbage.)

// Other situation: B is trimming the cache and A wants to read a file that is
// about to get deleted. std::filesystem::remove does whatever it is doing
// about to get deleted. boost::filesystem::remove does whatever it is doing
// before actually deleting the file. If A opens the file before the file is
// actually gone, the OS call from B to delete the file will fail since the OS
// will prevent this. B continues with the next file. If the file is already
Expand All @@ -96,34 +96,34 @@ void LLDiskCache::purge()
LL_INFOS() << "Total dir size before purge is " << dirFileSize(sCacheDir) << LL_ENDL;
}

std::error_code ec;
boost::system::error_code ec;
auto start_time = std::chrono::high_resolution_clock::now();

typedef std::pair<std::filesystem::file_time_type, std::pair<uintmax_t, std::string>> file_info_t;
typedef std::pair<std::time_t, std::pair<uintmax_t, std::string>> file_info_t;
std::vector<file_info_t> file_info;

#if LL_WINDOWS
std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0)
if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed())
{
std::filesystem::directory_iterator iter(cache_path, ec);
while (iter != std::filesystem::directory_iterator() && ec.value() == 0)
boost::filesystem::directory_iterator iter(cache_path, ec);
while (iter != boost::filesystem::directory_iterator() && !ec.failed())
{
if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0)
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
uintmax_t file_size = std::filesystem::file_size(*iter, ec);
if (ec.value() != 0)
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (ec.failed())
{
continue;
}
const std::string file_path = (*iter).path().string();
const std::filesystem::file_time_type file_time = std::filesystem::last_write_time(*iter, ec);
if (ec.value() != 0)
const std::time_t file_time = boost::filesystem::last_write_time(*iter, ec);
if (ec.failed())
{
continue;
}
Expand Down Expand Up @@ -159,8 +159,8 @@ void LLDiskCache::purge()
}
if (should_remove)
{
std::filesystem::remove(entry.second.second, ec);
if (ec.value() != 0)
boost::filesystem::remove(entry.second.second, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL;
}
Expand Down Expand Up @@ -224,23 +224,23 @@ void LLDiskCache::clearCache()
* the component files but it's called infrequently so it's
* likely just fine
*/
std::error_code ec;
boost::system::error_code ec;
#if LL_WINDOWS
std::wstring cache_path(ll_convert<std::wstring>(sCacheDir));
#else
std::string cache_path(sCacheDir);
#endif
if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0)
if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed())
{
std::filesystem::directory_iterator iter(cache_path, ec);
while (iter != std::filesystem::directory_iterator() && ec.value() == 0)
boost::filesystem::directory_iterator iter(cache_path, ec);
while (iter != boost::filesystem::directory_iterator() && !ec.failed())
{
if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0)
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
std::filesystem::remove(*iter, ec);
if (ec.value() != 0)
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
}
Expand All @@ -257,24 +257,24 @@ void LLDiskCache::removeOldVFSFiles()
static const char CACHE_FORMAT[] = "inv.llsd";
static const char DB_FORMAT[] = "db2.x";

std::error_code ec;
boost::system::error_code ec;
#if LL_WINDOWS
std::wstring cache_path(ll_convert<std::wstring>(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")));
#else
std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""));
#endif
if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0)
if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed())
{
std::filesystem::directory_iterator iter(cache_path, ec);
while (iter != std::filesystem::directory_iterator() && ec.value() == 0)
boost::filesystem::directory_iterator iter(cache_path, ec);
while (iter != boost::filesystem::directory_iterator() && !ec.failed())
{
if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0)
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) ||
((*iter).path().string().find(DB_FORMAT) != std::string::npos))
{
std::filesystem::remove(*iter, ec);
if (ec.value() != 0)
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
}
Expand All @@ -298,23 +298,23 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
* so if performance is ever an issue, optimizing this or removing it altogether,
* is an easy win.
*/
std::error_code ec;
boost::system::error_code ec;
#if LL_WINDOWS
std::wstring dir_path(ll_convert<std::wstring>(dir));
#else
std::string dir_path(dir);
#endif
if (std::filesystem::is_directory(dir_path, ec) && ec.value() == 0)
if (boost::filesystem::is_directory(dir_path, ec) && !ec.failed())
{
std::filesystem::directory_iterator iter(dir_path, ec);
while (iter != std::filesystem::directory_iterator() && ec.value() == 0)
boost::filesystem::directory_iterator iter(dir_path, ec);
while (iter != boost::filesystem::directory_iterator() && !ec.failed())
{
if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0)
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
uintmax_t file_size = std::filesystem::file_size(*iter, ec);
if (ec.value() == 0)
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (!ec.failed())
{
total_file_size += file_size;
}
Expand Down
Loading