Function renameZ [src]

Same as rename except the parameters are null-terminated.

Prototype

pub fn renameZ(self: Dir, old_sub_path_z: [*:0]const u8, new_sub_path_z: [*:0]const u8) RenameError!void

Parameters

self: Dirold_sub_path_z: [*:0]const u8new_sub_path_z: [*:0]const u8

Possible Errors

AccessDenied RenameError

In WASI, this error may occur when the file descriptor does not hold the required rights to rename a resource by path relative to it.

On Windows, this error may be returned instead of PathAlreadyExists when renaming a directory over an existing directory.

AntivirusInterference RenameError

On Windows, antivirus software is enabled by default. It can be disabled, but Windows Update sometimes ignores the user's preference and re-enables it. When enabled, antivirus software on Windows intercepts file system operations and makes them significantly slower in addition to possibly failing with this error code.

BadPathName RenameError
DiskQuota RenameError
FileBusy RenameError
FileNotFound RenameError
InvalidUtf8 RenameError

WASI-only; file paths must be valid UTF-8.

InvalidWtf8 RenameError

Windows-only; file paths provided by the user must be valid WTF-8. https://simonsapin.github.io/wtf-8/

IsDir RenameError
LinkQuotaExceeded RenameError
NameTooLong RenameError
NetworkNotFound RenameError

On Windows, \\server or \\server\share was not found.

NoDevice RenameError
NoSpaceLeft RenameError
NotDir RenameError
PathAlreadyExists RenameError
PermissionDenied RenameError
PipeBusy RenameError
ReadOnlyFileSystem RenameError
RenameAcrossMountPoints RenameError
SharingViolation RenameError
SymLinkLoop RenameError
SystemResources RenameError
Unexpected UnexpectedError

The Operating System returned an undocumented error code.

This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.

When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.

Source

pub fn renameZ(self: Dir, old_sub_path_z: [*:0]const u8, new_sub_path_z: [*:0]const u8) RenameError!void { return posix.renameatZ(self.fd, old_sub_path_z, self.fd, new_sub_path_z); }