// This source code is released into the public domain. module; #include #include export module nihil.posix:rename; import nihil.error; namespace nihil { // Rename a file (or directory). export [[nodiscard]] auto rename(std::filesystem::path const &oldp, std::filesystem::path const &newp) -> std::expected { auto err = std::error_code(); std::filesystem::rename(oldp, newp, err); if (err) return std::unexpected(error(err)); return {}; } } // namespace nihil