forked from rojo-rbx/rojo
feat: auto-resolve init-name conflicts during syncback
When a child instance has a Roblox name that would produce a filesystem name of "init" (case-insensitive), syncback now automatically prefixes it with '_' (e.g. "Init" → "_Init.luau") instead of erroring. The corresponding meta.json writes the original name via the `name` property so Rojo can restore it on the next snapshot. The sibling dedup check is updated to use actual on-disk names for existing children and the resolved (init-prefixed) name for new ones, so genuine collisions still error while false positives from the `name` property are avoided. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -237,6 +237,24 @@ pub fn inst_path(dom: &WeakDom, referent: Ref) -> String {
|
||||
path.join("/")
|
||||
}
|
||||
|
||||
impl<'sync> SyncbackData<'sync> {
|
||||
/// Constructs a `SyncbackData` for use in unit tests.
|
||||
#[cfg(test)]
|
||||
pub fn for_test(
|
||||
vfs: &'sync Vfs,
|
||||
old_tree: &'sync RojoTree,
|
||||
new_tree: &'sync WeakDom,
|
||||
project: &'sync Project,
|
||||
) -> Self {
|
||||
Self {
|
||||
vfs,
|
||||
old_tree,
|
||||
new_tree,
|
||||
project,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use rbx_dom_weak::{InstanceBuilder, WeakDom};
|
||||
|
||||
Reference in New Issue
Block a user