mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor metadata name handling for improved clarity
- Updated comments in `json_model.rs` and `meta_file.rs` to clarify the logic for storing the real name of instances when the filesystem name differs due to slugification or deduplication. - Simplified the conditions under which the real name is preserved, ensuring better readability and understanding of the code's intent.
This commit is contained in:
parent
5a5e1a0c77
commit
f38c1f1311
2 changed files with 14 additions and 12 deletions
|
|
@ -77,10 +77,12 @@ pub fn syncback_json_model<'sync>(
|
|||
// could have a performance cost.
|
||||
model.schema = old_inst.metadata().schema.clone();
|
||||
model.name = old_inst.metadata().specified_name.clone();
|
||||
} else if snapshot.needs_meta_name {
|
||||
// New instance whose filesystem name differs from the instance name
|
||||
// (due to slugification or deduplication). Store the real name so it
|
||||
// survives a round-trip through the filesystem.
|
||||
}
|
||||
// Filesystem name differs from the instance name (due to slugification
|
||||
// or deduplication). Store the real name so it survives a round-trip.
|
||||
// Checked independently: old_inst may exist but lack a specified_name
|
||||
// (e.g., a previously filesystem-safe name was renamed to need slugification).
|
||||
if model.name.is_none() && snapshot.needs_meta_name {
|
||||
model.name = Some(snapshot.new_inst().name.clone());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue