mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Fix non-portable path serialization in ProjectNode.
This was failing snapshot tests on the Linux CI machines, since I committed snapshots with backslashes. I think the old path serializer was still the wrong approach, this one is sort of a middleground but I'm still not super happy with it.
This commit is contained in:
@@ -36,3 +36,17 @@ where
|
|||||||
|
|
||||||
seq.end()
|
seq.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn serialize_option_absolute<S, T>(
|
||||||
|
maybe_path: &Option<T>,
|
||||||
|
serializer: S,
|
||||||
|
) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
T: AsRef<Path>,
|
||||||
|
{
|
||||||
|
match maybe_path {
|
||||||
|
Some(path) => serialize_absolute(path, serializer),
|
||||||
|
None => serializer.serialize_none(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ pub struct ProjectNode {
|
|||||||
pub children: BTreeMap<String, ProjectNode>,
|
pub children: BTreeMap<String, ProjectNode>,
|
||||||
pub properties: HashMap<String, UnresolvedRbxValue>,
|
pub properties: HashMap<String, UnresolvedRbxValue>,
|
||||||
pub ignore_unknown_instances: Option<bool>,
|
pub ignore_unknown_instances: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(serialize_with = "crate::path_serializer::serialize_option_absolute")]
|
||||||
pub path: Option<PathBuf>,
|
pub path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ children:
|
|||||||
children: {}
|
children: {}
|
||||||
properties: {}
|
properties: {}
|
||||||
ignore_unknown_instances: ~
|
ignore_unknown_instances: ~
|
||||||
path: "/foo\\file.txt"
|
path: /foo/file.txt
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/file.txt
|
- /foo/file.txt
|
||||||
- /foo/file.meta.json
|
- /foo/file.meta.json
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ children:
|
|||||||
children: {}
|
children: {}
|
||||||
properties: {}
|
properties: {}
|
||||||
ignore_unknown_instances: ~
|
ignore_unknown_instances: ~
|
||||||
path: "/foo\\file.txt"
|
path: /foo/file.txt
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/file.txt
|
- /foo/file.txt
|
||||||
- /foo/file.meta.json
|
- /foo/file.meta.json
|
||||||
|
|||||||
Reference in New Issue
Block a user