(
&self,
path: &Path,
conf: &OpenOptionsConfig,
)
| 152 | |
| 153 | impl virtual_fs::FileOpener for SyncHostFileSystem { |
| 154 | fn open( |
| 155 | &self, |
| 156 | path: &Path, |
| 157 | conf: &OpenOptionsConfig, |
| 158 | ) -> virtual_fs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> { |
| 159 | let path = self.prepare_path(path)?; |
| 160 | let append = conf.append() && !conf.truncate(); |
| 161 | let file = fs::OpenOptions::new() |
| 162 | .read(conf.read()) |
| 163 | .write(conf.write()) |
| 164 | .create_new(conf.create_new()) |
| 165 | .create(conf.create()) |
| 166 | .append(append) |
| 167 | .truncate(conf.truncate()) |
| 168 | .open(&path) |
| 169 | .map_err(FsError::from)?; |
| 170 | |
| 171 | Ok(Box::new(SyncHostFile::new(file, path)) as Box<dyn VirtualFile + Send + Sync + 'static>) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | #[derive(Debug)] |
nothing calls this directly
no test coverage detected