mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 22:25:26 +00:00
Move responsibility for extracting names from paths lower
This commit is contained in:
@@ -5,12 +5,15 @@ use memofs::Vfs;
|
||||
|
||||
use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
||||
|
||||
use super::util::PathExt;
|
||||
|
||||
pub fn snapshot_rbxmx(
|
||||
context: &InstanceContext,
|
||||
vfs: &Vfs,
|
||||
path: &Path,
|
||||
instance_name: &str,
|
||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||
let name = path.file_name_trim_end(".rbxmx")?;
|
||||
|
||||
let options = rbx_xml::DecodeOptions::new()
|
||||
.property_behavior(rbx_xml::DecodePropertyBehavior::ReadUnknown);
|
||||
|
||||
@@ -22,7 +25,7 @@ pub fn snapshot_rbxmx(
|
||||
|
||||
if children.len() == 1 {
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0])
|
||||
.name(instance_name)
|
||||
.name(name)
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(path)
|
||||
@@ -71,7 +74,6 @@ mod test {
|
||||
&InstanceContext::default(),
|
||||
&mut vfs,
|
||||
Path::new("/foo.rbxmx"),
|
||||
"foo",
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user