update StdfsDevice::removeAll

This commit is contained in:
MihailRis 2025-02-04 11:59:05 +03:00
parent ef170247cc
commit b955ae59c1

View File

@ -3,9 +3,13 @@
#include <fstream>
#include <filesystem>
#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 {