MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / make_dir

Method make_dir

ramdisk/src/main.rs:142–155  ·  view source on GitHub ↗

Make a sub-directory

(&mut self, path: &str)

Source from the content-addressed store, hash-verified

140
141 /// Make a sub-directory
142 fn make_dir(&mut self, path: &str) -> Result<Arc<RwLock<dyn DirLike + Send + Sync>>, syscalls::SyscallError> {
143 println!("[ramdisk] Making directory {}", path);
144 if path.contains(MAIN_SEP_STR) {
145 // Cannot contain separator
146 return Err(syscalls::SYSCALL_ERROR_PARAM);
147 }
148 if self.subdirs.contains_key(path) {
149 // Already exists
150 return Err(syscalls::SYSCALL_ERROR_EXISTS);
151 }
152 let new_dir = Arc::new(RwLock::new(Directory::new()));
153 self.subdirs.insert(String::from(path), new_dir.clone());
154 Ok(new_dir)
155 }
156 /// Create a new file, returning a shared reference
157 fn make_file(&mut self, name: &str) -> Result<Arc<RwLock<dyn FileLike + Send + Sync>>, syscalls::SyscallError> {
158 println!("[ramdisk] Making file {}", name);

Callers

nothing calls this directly

Calls 2

insertMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected