diff options
Diffstat (limited to 'src/server/database/Updater/UpdateFetcher.cpp')
-rw-r--r-- | src/server/database/Updater/UpdateFetcher.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index 1da370ee7b9..4f12f6c09cd 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -16,28 +16,40 @@ */ #include "UpdateFetcher.h" +#include "Common.h" +#include "DBUpdater.h" +#include "Field.h" #include "Log.h" +#include "QueryResult.h" #include "Util.h" #include "SHA1.h" - +#include <boost/filesystem/operations.hpp> #include <fstream> -#include <chrono> -#include <vector> #include <sstream> -#include <exception> -#include <unordered_map> using namespace boost::filesystem; +struct UpdateFetcher::DirectoryEntry +{ + DirectoryEntry(Path const& path_, State state_) : path(path_), state(state_) { } + + Path const path; + State const state; +}; + UpdateFetcher::UpdateFetcher(Path const& sourceDirectory, std::function<void(std::string const&)> const& apply, std::function<void(Path const& path)> const& applyFile, std::function<QueryResult(std::string const&)> const& retrieve) : - _sourceDirectory(sourceDirectory), _apply(apply), _applyFile(applyFile), + _sourceDirectory(Trinity::make_unique<Path>(sourceDirectory)), _apply(apply), _applyFile(applyFile), _retrieve(retrieve) { } +UpdateFetcher::~UpdateFetcher() +{ +} + UpdateFetcher::LocaleFileStorage UpdateFetcher::GetFileList() const { LocaleFileStorage files; @@ -95,7 +107,7 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons std::string path = fields[0].GetString(); if (path.substr(0, 1) == "$") - path = _sourceDirectory.generic_string() + path.substr(1); + path = _sourceDirectory->generic_string() + path.substr(1); Path const p(path); @@ -405,3 +417,8 @@ void UpdateFetcher::UpdateState(std::string const& name, State const state) cons // Update database _apply(update); } + +bool UpdateFetcher::PathCompare::operator()(LocaleFileEntry const& left, LocaleFileEntry const& right) const +{ + return left.first.filename().string() < right.first.filename().string(); +} |