mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
completely remove EnginePaths::resolve
This commit is contained in:
parent
b955ae59c1
commit
a653b063e6
12 changed files with 67 additions and 106 deletions
|
|
@ -10,6 +10,18 @@ namespace fs = std::filesystem;
|
|||
|
||||
static debug::Logger logger("io-stdfs");
|
||||
|
||||
StdfsDevice::StdfsDevice(fs::path root, bool createDirectory)
|
||||
: root(std::move(root)) {
|
||||
if (createDirectory && !fs::is_directory(this->root)) {
|
||||
std::error_code ec;
|
||||
fs::create_directories(this->root, ec);
|
||||
if (ec) {
|
||||
logger.error() << "error creating root directory " << this->root
|
||||
<< ": " << ec.message();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fs::path StdfsDevice::resolve(std::string_view path) {
|
||||
return root / fs::u8path(path);
|
||||
}
|
||||
|
|
@ -54,7 +66,13 @@ bool StdfsDevice::isfile(std::string_view path) {
|
|||
|
||||
void StdfsDevice::mkdirs(std::string_view path) {
|
||||
auto resolved = resolve(path);
|
||||
fs::create_directories(resolved);
|
||||
|
||||
std::error_code ec;
|
||||
fs::create_directories(resolved, ec);
|
||||
if (ec) {
|
||||
logger.error() << "error creating directory " << resolved << ": "
|
||||
<< ec.message();
|
||||
}
|
||||
}
|
||||
|
||||
bool StdfsDevice::remove(std::string_view path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue