add io::Device::mkdir

This commit is contained in:
MihailRis
2025-02-04 14:10:23 +03:00
parent f8d0ded70e
commit 1ec8f89599
6 changed files with 37 additions and 9 deletions
+15 -2
View File
@@ -64,15 +64,28 @@ bool StdfsDevice::isfile(std::string_view path) {
return fs::is_regular_file(resolved);
}
void StdfsDevice::mkdirs(std::string_view path) {
bool StdfsDevice::mkdir(std::string_view path) {
auto resolved = resolve(path);
std::error_code ec;
fs::create_directories(resolved, ec);
bool created = fs::create_directory(resolved, ec);
if (ec) {
logger.error() << "error creating directory " << resolved << ": "
<< ec.message();
}
return created;
}
bool StdfsDevice::mkdirs(std::string_view path) {
auto resolved = resolve(path);
std::error_code ec;
bool created = fs::create_directories(resolved, ec);
if (ec) {
logger.error() << "error creating directories " << resolved << ": "
<< ec.message();
}
return created;
}
bool StdfsDevice::remove(std::string_view path) {