mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Ignore empty/whitespace-only model.json files
This commit is contained in:
parent
532d170585
commit
eba105701b
1 changed files with 11 additions and 0 deletions
|
|
@ -18,6 +18,17 @@ pub fn snapshot_json_model(
|
||||||
instance_name: &str,
|
instance_name: &str,
|
||||||
) -> SnapshotInstanceResult {
|
) -> SnapshotInstanceResult {
|
||||||
let contents = vfs.read(path)?;
|
let contents = vfs.read(path)?;
|
||||||
|
if contents.is_empty() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
if match String::from_utf8((*contents).to_owned()) {
|
||||||
|
Ok(v) => v.is_empty() || v.trim().is_empty(),
|
||||||
|
_ => false,
|
||||||
|
} {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
let instance: JsonModel = serde_json::from_slice(&contents)
|
let instance: JsonModel = serde_json::from_slice(&contents)
|
||||||
.with_context(|| format!("File is not a valid JSON model: {}", path.display()))?;
|
.with_context(|| format!("File is not a valid JSON model: {}", path.display()))?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue