fileutils: move API to std::filesystem, cleanup
Change-Id: I5408d193bda6830395bd705371c86c949643ee74
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index baab5af..55a6929 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1300,7 +1300,7 @@
ConnectionManager::Impl::dhParams() const
{
return dht::ThreadPool::computation().get<tls::DhParams>(
- std::bind(tls::DhParams::loadDhParams, config_->cachePath + DIR_SEPARATOR_STR "dhParams"));
+ std::bind(tls::DhParams::loadDhParams, config_->cachePath / "dhParams"));
}
template<typename ID = dht::Value::Id>
@@ -1330,7 +1330,7 @@
template<typename List = std::set<dht::Value::Id>>
void
-saveIdList(const std::string& path, const List& ids)
+saveIdList(const std::filesystem::path& path, const List& ids)
{
std::ofstream file = fileutils::ofstream(path, std::ios::trunc | std::ios::binary);
if (!file.is_open()) {
@@ -1345,7 +1345,7 @@
ConnectionManager::Impl::loadTreatedMessages()
{
std::lock_guard<std::mutex> lock(messageMutex_);
- auto path = config_->cachePath + DIR_SEPARATOR_STR "treatedMessages";
+ auto path = config_->cachePath / "treatedMessages";
treatedMessages_ = loadIdList<std::string>(path);
if (treatedMessages_.empty()) {
auto messages = loadIdList(path);
@@ -1362,8 +1362,7 @@
auto& this_ = *sthis;
std::lock_guard<std::mutex> lock(this_.messageMutex_);
fileutils::check_dir(this_.config_->cachePath.c_str());
- saveIdList<decltype(this_.treatedMessages_)>(this_.config_->cachePath
- + DIR_SEPARATOR_STR "treatedMessages",
+ saveIdList<decltype(this_.treatedMessages_)>(this_.config_->cachePath / "treatedMessages",
this_.treatedMessages_);
}
});