mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-22 21:55:15 +00:00
fix: lack of .model.json support
This commit is contained in:
@@ -35,19 +35,12 @@ pub fn snapshot_json_model(
|
||||
format!("File is not a valid JSON model: {}", path.display())
|
||||
})?;
|
||||
|
||||
if let Some(top_level_name) = &instance.name {
|
||||
let new_name = format!("{}.model.json", top_level_name);
|
||||
// If the JSON has a name property, preserve it in metadata for syncback
|
||||
let specified_name = instance.name.clone();
|
||||
|
||||
log::warn!(
|
||||
"Model at path {} had a top-level Name field. \
|
||||
This field has been ignored since Rojo 6.0.\n\
|
||||
Consider removing this field and renaming the file to {}.",
|
||||
new_name,
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
|
||||
instance.name = Some(name.to_owned());
|
||||
// Use the name from JSON if present, otherwise fall back to filename-derived name
|
||||
let instance_name = specified_name.clone().unwrap_or_else(|| name.to_owned());
|
||||
instance.name = Some(instance_name);
|
||||
|
||||
let id = instance.id.take().map(RojoRef::new);
|
||||
let schema = instance.schema.take();
|
||||
@@ -62,7 +55,8 @@ pub fn snapshot_json_model(
|
||||
.relevant_paths(vec![path.to_path_buf()])
|
||||
.context(context)
|
||||
.specified_id(id)
|
||||
.schema(schema);
|
||||
.schema(schema)
|
||||
.specified_name(specified_name);
|
||||
|
||||
Ok(Some(snapshot))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user