INNER CODE UNIT · Rust
write
XayahSuSuSu/Android-DataBackup · source-next/native/src/main/jni/rustic/src/mapped_source.rs:304
fn write(&self, path: &str, content: &str) -> PathBuf {
let file = self.0.join(path);
std::fs::create_dir_all(file.parent().unwrap()).unwrap();
std::fs::write(&file, content).unwrap();
file
}
fn mapping(&self, source: &str, target: &str) -> SourceMapping {
SourceMapping {
source_path: self.0.join(source).to_string_lossy().into_owned(),
snapshot_path: target.into(),
}
}
}
impl Drop for Workspace {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}