Fix path_remove_directory on *nixes
This commit is contained in:
1
build.rs
1
build.rs
@@ -165,7 +165,6 @@ cfg_if::cfg_if! {
|
|||||||
match name {
|
match name {
|
||||||
"path_rename_trailing_slashes" => true,
|
"path_rename_trailing_slashes" => true,
|
||||||
"path_symlink_trailing_slashes" => true,
|
"path_symlink_trailing_slashes" => true,
|
||||||
"remove_directory_trailing_slashes" => true,
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -978,7 +978,9 @@ pub(crate) unsafe fn path_remove_directory(
|
|||||||
let dirfd = wasi_ctx
|
let dirfd = wasi_ctx
|
||||||
.get_fd_entry(dirfd, host::__WASI_RIGHT_PATH_REMOVE_DIRECTORY, 0)
|
.get_fd_entry(dirfd, host::__WASI_RIGHT_PATH_REMOVE_DIRECTORY, 0)
|
||||||
.and_then(|fe| fe.fd_object.descriptor.as_file())?;
|
.and_then(|fe| fe.fd_object.descriptor.as_file())?;
|
||||||
let resolved = path_get(dirfd, 0, path, false)?;
|
let resolved = path_get(dirfd, 0, path, true)?;
|
||||||
|
|
||||||
|
log::debug!("path_remove_directory resolved={:?}", resolved);
|
||||||
|
|
||||||
hostcalls_impl::path_remove_directory(resolved)
|
hostcalls_impl::path_remove_directory(resolved)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::{host, Error, Result};
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::{Component, Path};
|
use std::path::{Component, Path};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub(crate) struct PathGet {
|
pub(crate) struct PathGet {
|
||||||
dirfd: File,
|
dirfd: File,
|
||||||
path: String,
|
path: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user