Remove a directory.
path_remove_directory() function removes a directory specified by the given path. It requires the
PATH_REMOVE_DIRECTORY right to be set on the directory.
On POSIX systems, a similar functionality is provided by the
rmdir() function. It removes an empty directory with the specified path. The
rmdir() function is part of the POSIX standard and is widely supported across different platforms.
;;; Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. ;;; Return `errno::notempty` if the directory is not empty. ;;; Remove a directory. (@interface func (export "path_remove_directory") (param $fd $fd) ;;; The path to a directory to remove. (param $path string) (result $error (expected (error $errno))) )
ctx: A mutable reference to the function environment.
fd: The file descriptor representing the base directory from which the path is resolved.
path: A wasm pointer to a null-terminated string containing the path of the directory to remove.
path_len: The length of the
The function returns an
Errno value indicating the success or failure of the operation. If the operation is successful, it returns
Errno::Success. Otherwise, it returns an appropriate
This function has been instrumented with debug-level logging. It will log the following information:
%fd: The file descriptor representing the base directory.
path: The path string.
path_remove_directory() function removes a directory specified by the given path. It checks if the directory is empty and has the necessary rights to be removed. On POSIX systems, a similar functionality is provided by the