From 7547d675a20133cb13f0882e424d4f9af37edf01 Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 8 Aug 2026 08:32:29 -0400 Subject: [PATCH] Rename added --- libi2pd/FS.cpp | 14 ++++++++++++++ libi2pd/FS.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/libi2pd/FS.cpp b/libi2pd/FS.cpp index 211ecc6c..ac8fbfbf 100644 --- a/libi2pd/FS.cpp +++ b/libi2pd/FS.cpp @@ -281,6 +281,20 @@ namespace fs { return fs_lib::remove(path); } + bool Rename (std::string_view from, std::string_view to) + { + try + { + fs_lib::rename (from, to); + } + catch (std::exception& ex) + { + LogPrint (eLogError, "FS: Can't rename from ", from, " to ", to, " : ", ex.what()); + return false; + } + return true; + } + bool CreateAndReserveFile (const std::string& path, size_t reserve) { if (fs_lib::exists(path)) return false; diff --git a/libi2pd/FS.h b/libi2pd/FS.h index d8277d90..d4ff2c6c 100644 --- a/libi2pd/FS.h +++ b/libi2pd/FS.h @@ -139,6 +139,8 @@ namespace fs { */ bool Remove(const std::string & path); + bool Rename (std::string_view from, std::string_view to); + /** * @brief Check existence of file * @param path Absolute path to file