use std::{io::Result, path::Path};
use working_dir::Dir;
fn main() -> Result<()> {
let cwd = Dir::new("my/root");
let path = Path::new("path/to/file.txt");
cwd.create_parents(path)?;
cwd.write(path, "Hello, world!\n")?;
assert!(!path.exists());
assert!(cwd.exists(path));
assert!(Path::new("my/root/path/to/file.txt").exists());
assert_eq!(cwd.read_to_string(path)?, "Hello, world!\n");
let other_cwd = Dir::new("some/other/root");
cwd.move_to(&other_cwd, path)?;
assert!(!cwd.exists(path));
assert!(other_cwd.exists(path));
Ok(())
}