Files
rojo/server/tests/test_util/mod.rs
Lucien Greathouse ec0a1f1ce4 New snapshot tests (#134)
* Changes project-related structures to use `BTreeMap` instead of `HashMap` for children to aid determiniusm
* Changes imfs-related structures to have total ordering and use `BTreeSet` instead of `HashSet`
* Upgrades dependencies to `bx_dom_weak`1.2.0 and rbx_xml 0.5.0 to aid in more determinism stuff
* Re-exposes the `RbxSession`'s root project via `root_project()`
* Implements `Default` for a couple things
* Tweaks visualization code to support visualizing trees not attached to an `RbxSession`
* Adds an ID-invariant comparison method for `rbx_tree` relying on previous determinism changes
* Adds a (disabled) test to start finding issues in the reconciler with regards to communicativity of snapshot application
* Adds a snapshot testing system that operates on `RbxTree` and associated metadata, which are committed in this change
2019-03-14 14:20:03 -07:00

36 lines
868 B
Rust

#![allow(dead_code)]
use std::fs::{create_dir, copy};
use std::path::Path;
use std::io;
use walkdir::WalkDir;
pub mod snapshot;
pub mod tree;
pub fn copy_recursive(from: &Path, to: &Path) -> io::Result<()> {
for entry in WalkDir::new(from) {
let entry = entry?;
let path = entry.path();
let new_path = to.join(path.strip_prefix(from).unwrap());
let file_type = entry.file_type();
if file_type.is_dir() {
match create_dir(new_path) {
Ok(_) => {},
Err(err) => match err.kind() {
io::ErrorKind::AlreadyExists => {},
_ => panic!(err),
}
}
} else if file_type.is_file() {
copy(path, new_path)?;
} else {
unimplemented!("no symlinks please");
}
}
Ok(())
}