mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor metadata file name generation in syncback_lua to utilize the file stem from the script path, ensuring proper handling of Windows-invalid characters while maintaining compatibility with existing naming conventions.
This commit is contained in:
parent
f54367e5e0
commit
978dd41047
1 changed files with 14 additions and 5 deletions
|
|
@ -159,11 +159,20 @@ pub fn syncback_lua<'sync>(
|
|||
|
||||
if !meta.is_empty() {
|
||||
let parent_location = snapshot.path.parent_err()?;
|
||||
let meta_name = if snapshot.encode_windows_invalid_chars() {
|
||||
encode_path_name(&new_inst.name)
|
||||
} else {
|
||||
new_inst.name.clone()
|
||||
};
|
||||
// Use the file stem from the script path (e.g., "Foo.server" from "Foo.server.luau")
|
||||
// to match how AdjacentMetadata::read_and_apply_all looks for meta files.
|
||||
let meta_name = snapshot
|
||||
.path
|
||||
.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| {
|
||||
if snapshot.encode_windows_invalid_chars() {
|
||||
encode_path_name(&new_inst.name)
|
||||
} else {
|
||||
new_inst.name.clone()
|
||||
}
|
||||
});
|
||||
fs_snapshot.add_file(
|
||||
parent_location.join(format!("{}.meta.json", meta_name)),
|
||||
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue