connection manager: cleanup
Change-Id: I6a5d7b458f033f0d3dfebefb29bc7a097720e701
diff --git a/include/fileutils.h b/include/fileutils.h
index 7b1cc72..f3bdb5c 100644
--- a/include/fileutils.h
+++ b/include/fileutils.h
@@ -87,19 +87,6 @@
int removeAll(const std::filesystem::path& path, bool erase = false);
/**
- * Wrappers for fstream opening that will convert paths to wstring
- * on windows
- */
-void openStream(std::ifstream& file,
- const std::filesystem::path& path,
- std::ios_base::openmode mode = std::ios_base::in);
-void openStream(std::ofstream& file,
- const std::filesystem::path& path,
- std::ios_base::openmode mode = std::ios_base::out);
-std::ifstream ifstream(const std::filesystem::path& path, std::ios_base::openmode mode = std::ios_base::in);
-std::ofstream ofstream(const std::filesystem::path& path, std::ios_base::openmode mode = std::ios_base::out);
-
-/**
* Windows compatibility wrapper for checking read-only attribute
*/
int accessFile(const std::string& file, int mode);
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 0b97ac5..238f4b4 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1306,10 +1306,10 @@
template<typename ID = dht::Value::Id>
std::set<ID, std::less<>>
-loadIdList(const std::string& path)
+loadIdList(const std::filesystem::path& path)
{
std::set<ID, std::less<>> ids;
- std::ifstream file = fileutils::ifstream(path);
+ std::ifstream file(path);
if (!file.is_open()) {
//JAMI_DBG("Could not load %s", path.c_str());
return ids;
@@ -1333,7 +1333,7 @@
void
saveIdList(const std::filesystem::path& path, const List& ids)
{
- std::ofstream file = fileutils::ofstream(path, std::ios::trunc | std::ios::binary);
+ std::ofstream file(path, std::ios::trunc | std::ios::binary);
if (!file.is_open()) {
//JAMI_ERR("Could not save to %s", path.c_str());
return;
diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index 7ba5eb8..23aceff 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -153,7 +153,7 @@
loadFile(const std::filesystem::path& path)
{
std::vector<uint8_t> buffer;
- std::ifstream file = ifstream(path, std::ios::binary);
+ std::ifstream file(path, std::ios::binary);
if (!file)
throw std::runtime_error("Can't read file: " + path.string());
file.seekg(0, std::ios::end);
@@ -170,7 +170,7 @@
void
saveFile(const std::filesystem::path& path, const uint8_t* data, size_t data_size, mode_t mode)
{
- std::ofstream file = fileutils::ofstream(path, std::ios::trunc | std::ios::binary);
+ std::ofstream file(path, std::ios::trunc | std::ios::binary);
if (!file.is_open()) {
//JAMI_ERR("Could not write data to %s", path.c_str());
return;