Create an early scripting engine #2
|
@ -237,6 +237,7 @@ impl ResourceManager {
|
|||
let path = resource.path();
|
||||
if let Some(loader) = self.loaders.iter()
|
||||
.find(|l| l.does_support_file(&path)) {
|
||||
println!("got loader");
|
||||
let loader = Arc::clone(loader); // stop borrowing from self
|
||||
let loaded = loader.load(self, &path)?;
|
||||
let loaded = loaded.as_arc_any();
|
||||
|
@ -325,6 +326,7 @@ mod tests {
|
|||
let img = res.try_data_ref();
|
||||
img.unwrap();
|
||||
|
||||
println!("Path = {}", res.path());
|
||||
man.reload(res.clone()).unwrap();
|
||||
assert_eq!(res.version(), 1);
|
||||
|
||||
|
@ -334,8 +336,9 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn watch_image() {
|
||||
let image_path = get_image("squiggles.png");
|
||||
let image_bytes = std::fs::read(&image_path).unwrap();
|
||||
let orig_path = get_image("squiggles.png");
|
||||
let image_path = get_image("squiggles_test.png");
|
||||
std::fs::copy(orig_path, &image_path).unwrap();
|
||||
|
||||
let mut man = ResourceManager::new();
|
||||
let res = man.request::<Texture>(&image_path).unwrap();
|
||||
|
@ -350,8 +353,6 @@ mod tests {
|
|||
let event = recv.recv().unwrap();
|
||||
let event = event.unwrap();
|
||||
|
||||
std::fs::write(image_path, image_bytes).unwrap();
|
||||
|
||||
assert!(event.iter().any(|ev| ev.kind.is_remove() || ev.kind.is_modify()));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue