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

Method _open

euralios_std/src/fs.rs:171–186  ·  view source on GitHub ↗
(&self, path: &Path)

Source from the content-addressed store, hash-verified

169 }
170
171 fn _open(&self, path: &Path) -> Result<File, SyscallError> {
172 let flags = message::O_READ +
173 if self.write || self.append { message::O_WRITE } else { 0 } +
174 if self.create { message::O_CREATE } else { 0 } +
175 if self.truncate { message::O_TRUNCATE } else { 0 };
176
177 let pwd_or_err = env::current_dir();
178 let handle = if path.is_relative() & pwd_or_err.is_ok() {
179 let mut abspath = pwd_or_err.unwrap();
180 abspath.push(path);
181 syscalls::open(abspath.as_os_str(), flags)?
182 } else {
183 syscalls::open(path.as_os_str(), flags)?
184 };
185 Ok(File(handle))
186 }
187}
188
189/// Represents a file

Callers 1

openMethod · 0.80

Calls 6

current_dirFunction · 0.85
is_relativeMethod · 0.80
as_os_strMethod · 0.80
openFunction · 0.70
FileClass · 0.70
pushMethod · 0.45

Tested by

no test coverage detected