mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
update StdfsDevice::removeAll
This commit is contained in:
parent
ef170247cc
commit
b955ae59c1
1 changed files with 10 additions and 1 deletions
|
|
@ -3,9 +3,13 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include "debug/Logger.hpp"
|
||||||
|
|
||||||
using namespace io;
|
using namespace io;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static debug::Logger logger("io-stdfs");
|
||||||
|
|
||||||
fs::path StdfsDevice::resolve(std::string_view path) {
|
fs::path StdfsDevice::resolve(std::string_view path) {
|
||||||
return root / fs::u8path(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) {
|
uint64_t StdfsDevice::removeAll(std::string_view path) {
|
||||||
auto resolved = resolve(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 {
|
class StdfsPathsGenerator : public PathsGenerator {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue