diff --git a/remotefs-fuse/tests/driver/mod.rs b/remotefs-fuse/tests/driver/mod.rs index 9d3b9d0..aef86e1 100644 --- a/remotefs-fuse/tests/driver/mod.rs +++ b/remotefs-fuse/tests/driver/mod.rs @@ -66,6 +66,7 @@ fn make_file_at(remote: &mut MemoryFs, path: &Path, content: &[u8]) { /// Make directory on the remote fs at `path` /// /// All the stems in the path will be created if they do not exist. +#[cfg(windows)] fn make_dir_at(remote: &mut MemoryFs, path: &Path) { use path_slash::PathBufExt; @@ -85,3 +86,23 @@ fn make_dir_at(remote: &mut MemoryFs, path: &Path) { } } } + +/// Make directory on the remote fs at `path` +/// +/// All the stems in the path will be created if they do not exist. +#[cfg(unix)] +fn make_dir_at(remote: &mut MemoryFs, path: &Path) { + let mut abs_path = Path::new("/").to_path_buf(); + for stem in path.iter() { + abs_path.push(stem); + println!("Creating directory: {abs_path:?}"); + match remote.create_dir(&abs_path, UnixPex::from(0o755)) { + Ok(_) + | Err(RemoteError { + kind: RemoteErrorType::DirectoryAlreadyExists, + .. + }) => {} + Err(err) => panic!("Failed to create directory: {err}"), + } + } +}