mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Preserve and restore instigating source in Lua snapshot initialization
- Added logic to preserve the init script's instigating source before copying directory metadata, ensuring accurate file path references. - Updated snapshot files to reflect the correct instigating source path for improved synchronization and consistency in tests.
This commit is contained in:
parent
730cdbda28
commit
a7f36fab5e
3 changed files with 10 additions and 4 deletions
|
|
@ -128,10 +128,16 @@ pub fn snapshot_lua_init(
|
||||||
let mut init_snapshot =
|
let mut init_snapshot =
|
||||||
snapshot_lua(context, vfs, init_path, &dir_snapshot.name, script_type)?.unwrap();
|
snapshot_lua(context, vfs, init_path, &dir_snapshot.name, script_type)?.unwrap();
|
||||||
|
|
||||||
|
// Preserve the init script's instigating_source (the actual file path)
|
||||||
|
// before copying the directory's metadata (which has the folder path)
|
||||||
|
let script_instigating_source = init_snapshot.metadata.instigating_source.take();
|
||||||
|
|
||||||
init_snapshot.children = dir_snapshot.children;
|
init_snapshot.children = dir_snapshot.children;
|
||||||
init_snapshot.metadata = dir_snapshot.metadata;
|
init_snapshot.metadata = dir_snapshot.metadata;
|
||||||
// The directory snapshot middleware includes all possible init paths
|
|
||||||
// so we don't need to add it here.
|
// Restore the init script's instigating_source so two-way sync writes
|
||||||
|
// to the actual file (e.g., init.luau) instead of the directory
|
||||||
|
init_snapshot.metadata.instigating_source = script_instigating_source;
|
||||||
|
|
||||||
DirectoryMetadata::read_and_apply_all(vfs, folder_path, &mut init_snapshot)?;
|
DirectoryMetadata::read_and_apply_all(vfs, folder_path, &mut init_snapshot)?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ snapshot_id: "00000000000000000000000000000000"
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: false
|
ignore_unknown_instances: false
|
||||||
instigating_source:
|
instigating_source:
|
||||||
Path: /root
|
Path: /root/init.lua
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /root
|
- /root
|
||||||
- /root/init.lua
|
- /root/init.lua
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ snapshot_id: "00000000000000000000000000000000"
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: false
|
ignore_unknown_instances: false
|
||||||
instigating_source:
|
instigating_source:
|
||||||
Path: /root
|
Path: /root/init.lua
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /root
|
- /root
|
||||||
- /root/init.lua
|
- /root/init.lua
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue