unreal-sdk: method for deserializing sdk from .ron file
This commit is contained in:
parent
dab24aed61
commit
9e53c9d199
|
@ -66,6 +66,13 @@ impl Sdk {
|
||||||
.and_then(|text| std::fs::write(path, text).context("failed to write to file."))
|
.and_then(|text| std::fs::write(path, text).context("failed to write to file."))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_path_ron<P: AsRef<Path>>(path: P) -> anyhow::Result<Self> {
|
||||||
|
let contents = std::fs::read(path)?;
|
||||||
|
let new = ron::de::from_bytes::<Self>(&contents)?;
|
||||||
|
|
||||||
|
Ok(new)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_object(&self, key: &ObjectRef) -> Option<&UnrealType> {
|
pub fn get_object(&self, key: &ObjectRef) -> Option<&UnrealType> {
|
||||||
self.packages
|
self.packages
|
||||||
.get(&key.package)
|
.get(&key.package)
|
||||||
|
|
Loading…
Reference in a new issue