Implement fs::error::notempty

This commit is contained in:
Nekotekina 2017-09-12 20:05:38 +03:00
parent 22d8b57027
commit 669d953529
3 changed files with 5 additions and 0 deletions

View File

@ -94,6 +94,7 @@ static fs::error to_error(DWORD e)
case ERROR_DIRECTORY: return fs::error::inval;
case ERROR_INVALID_NAME: return fs::error::inval;
case ERROR_SHARING_VIOLATION: return fs::error::acces;
case ERROR_DIR_NOT_EMPTY: return fs::error::notempty;
default: fmt::throw_exception("Unknown Win32 error: %u.", e);
}
}
@ -128,6 +129,7 @@ static fs::error to_error(int e)
case EEXIST: return fs::error::exist;
case EINVAL: return fs::error::inval;
case EACCES: return fs::error::acces;
case ENOTEMPTY: return fs::error::notempty;
default: fmt::throw_exception("Unknown system error: %d.", e);
}
}
@ -1449,6 +1451,7 @@ void fmt_class_string<fs::error>::format(std::string& out, u64 arg)
case fs::error::noent: return "Not found";
case fs::error::exist: return "Already exists";
case fs::error::acces: return "Access violation";
case fs::error::notempty: return "Not empty";
}
return unknown;

View File

@ -502,6 +502,7 @@ namespace fs
noent,
exist,
acces,
notempty,
};
// Error code returned

View File

@ -622,6 +622,7 @@ error_code sys_fs_rmdir(vm::cptr<char> path)
switch (auto error = fs::g_tls_error)
{
case fs::error::noent: return {CELL_ENOENT, path};
case fs::error::notempty: return {CELL_ENOTEMPTY, path};
default: sys_fs.error("sys_fs_rmdir(): unknown error %s", error);
}