Implement Syncback to support converting Roblox files to a Rojo project (#937)

This is a very large commit.
Consider checking the linked PR for more information.
This commit is contained in:
Micah
2025-11-19 09:21:33 -08:00
committed by GitHub
parent 071b6e7e23
commit 9b5a07191b
239 changed files with 5325 additions and 225 deletions

View File

@@ -5,24 +5,32 @@ use std::path::Path;
use serde::{ser::SerializeSeq, Serialize, Serializer};
pub fn serialize_absolute<S, T>(path: T, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
T: AsRef<Path>,
{
/// Converts the provided value into a String with all directory separators
/// converted into `/`.
pub fn display_absolute<T: AsRef<Path>>(path: T) -> String {
let as_str = path
.as_ref()
.as_os_str()
.to_str()
.expect("Invalid Unicode in file path, cannot serialize");
let replaced = as_str.replace('\\', "/");
as_str.replace('\\', "/")
}
serializer.serialize_str(&replaced)
/// A serializer for serde that serialize a value with all directory separators
/// converted into `/`.
pub fn serialize_absolute<S, T>(path: T, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
T: AsRef<Path>,
{
serializer.serialize_str(&display_absolute(path))
}
#[derive(Serialize)]
struct WithAbsolute<'a>(#[serde(serialize_with = "serialize_absolute")] &'a Path);
/// A serializer for serde that serialize a list of values with all directory
/// separators converted into `/`.
pub fn serialize_vec_absolute<S, T>(paths: &[T], serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,