From b955ae59c11014a54ee93c91b75c5eb86a1e4f8b Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 4 Feb 2025 11:59:05 +0300 Subject: [PATCH] update StdfsDevice::removeAll --- src/io/devices/StdfsDevice.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/io/devices/StdfsDevice.cpp b/src/io/devices/StdfsDevice.cpp index 89c585ca..98ef1568 100644 --- a/src/io/devices/StdfsDevice.cpp +++ b/src/io/devices/StdfsDevice.cpp @@ -3,9 +3,13 @@ #include #include +#include "debug/Logger.hpp" + using namespace io; namespace fs = std::filesystem; +static debug::Logger logger("io-stdfs"); + fs::path StdfsDevice::resolve(std::string_view path) { return root / fs::u8path(path); } @@ -60,7 +64,12 @@ bool StdfsDevice::remove(std::string_view path) { uint64_t StdfsDevice::removeAll(std::string_view path) { auto resolved = resolve(path); - return fs::remove_all(resolved); + if (fs::exists(resolved)) { + logger.info() << "removeAll " << resolved; + return fs::remove_all(resolved); + } else { + return 0; + } } class StdfsPathsGenerator : public PathsGenerator {