mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-25 04:54:07 +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() {
|
if !meta.is_empty() {
|
||||||
let parent_location = snapshot.path.parent_err()?;
|
let parent_location = snapshot.path.parent_err()?;
|
||||||
let meta_name = if snapshot.encode_windows_invalid_chars() {
|
// Use the file stem from the script path (e.g., "Foo.server" from "Foo.server.luau")
|
||||||
encode_path_name(&new_inst.name)
|
// to match how AdjacentMetadata::read_and_apply_all looks for meta files.
|
||||||
} else {
|
let meta_name = snapshot
|
||||||
new_inst.name.clone()
|
.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(
|
fs_snapshot.add_file(
|
||||||
parent_location.join(format!("{}.meta.json", meta_name)),
|
parent_location.join(format!("{}.meta.json", meta_name)),
|
||||||
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
|
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue