mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Implement encoding for Windows-invalid characters in syncback metadata file names across CSV, Lua, and TXT handlers. Updated file name generation to conditionally encode names based on the presence of invalid characters.
This commit is contained in:
parent
81f72681c6
commit
8c776c09b3
3 changed files with 21 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ use rbx_dom_weak::{types::Variant, ustr};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
path_encoding::encode_path_name,
|
||||
snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot},
|
||||
syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot},
|
||||
};
|
||||
|
|
@ -109,8 +110,13 @@ pub fn syncback_csv<'sync>(
|
|||
|
||||
if !meta.is_empty() {
|
||||
let parent = snapshot.path.parent_err()?;
|
||||
let meta_name = if snapshot.encode_windows_invalid_chars() {
|
||||
encode_path_name(&new_inst.name)
|
||||
} else {
|
||||
new_inst.name.clone()
|
||||
};
|
||||
fs_snapshot.add_file(
|
||||
parent.join(format!("{}.meta.json", new_inst.name)),
|
||||
parent.join(format!("{}.meta.json", meta_name)),
|
||||
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use rbx_dom_weak::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
path_encoding::encode_path_name,
|
||||
snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot},
|
||||
syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot},
|
||||
};
|
||||
|
|
@ -158,8 +159,13 @@ 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()
|
||||
};
|
||||
fs_snapshot.add_file(
|
||||
parent_location.join(format!("{}.meta.json", new_inst.name)),
|
||||
parent_location.join(format!("{}.meta.json", meta_name)),
|
||||
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use rbx_dom_weak::types::Variant;
|
|||
use rbx_dom_weak::ustr;
|
||||
|
||||
use crate::{
|
||||
path_encoding::encode_path_name,
|
||||
snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot},
|
||||
syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot},
|
||||
};
|
||||
|
|
@ -58,8 +59,13 @@ pub fn syncback_txt<'sync>(
|
|||
|
||||
if !meta.is_empty() {
|
||||
let parent = snapshot.path.parent_err()?;
|
||||
let meta_name = if snapshot.encode_windows_invalid_chars() {
|
||||
encode_path_name(&new_inst.name)
|
||||
} else {
|
||||
new_inst.name.clone()
|
||||
};
|
||||
fs_snapshot.add_file(
|
||||
parent.join(format!("{}.meta.json", new_inst.name)),
|
||||
parent.join(format!("{}.meta.json", meta_name)),
|
||||
crate::json::to_vec_pretty_sorted(&meta).context("could not serialize metadata")?,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue