Ignore no return value from model.json files during snapshot

This commit is contained in:
Mixu78
2021-04-24 23:31:57 +03:00
parent eba105701b
commit 0aef16e30a
2 changed files with 7 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ use crate::{
snapshot::{
apply_patch_set, compute_patch_set, AppliedPatchSet, InstigatingSource, PatchSet, RojoTree,
},
snapshot_middleware::{snapshot_from_vfs, snapshot_project_node},
snapshot_middleware::{snapshot_from_vfs, snapshot_project_node, util::match_file_name},
};
/// Owns the connection between Rojo's VFS and its DOM by holding onto another
@@ -283,6 +283,11 @@ fn compute_and_apply_changes(tree: &mut RojoTree, vfs: &Vfs, id: Ref) -> Option<
let snapshot = match snapshot_from_vfs(&metadata.context, &vfs, &path) {
Ok(Some(snapshot)) => snapshot,
Ok(None) => {
// If the file that didn't return an instance is a model.json file
// no return is expected as empty/whitespace mode.json files are ignored
if let Some(_) = match_file_name(path, ".model.json") {
return None;
}
log::error!(
"Snapshot did not return an instance from path {}",
path.display()

View File

@@ -14,7 +14,7 @@ mod project;
mod rbxm;
mod rbxmx;
mod txt;
mod util;
pub mod util;
use std::path::Path;