From 9e53c9d199f698c601c5fb94416acea4cdd94cbc Mon Sep 17 00:00:00 2001 From: Janis Date: Thu, 29 Jun 2023 16:26:55 +0200 Subject: [PATCH] unreal-sdk: method for deserializing sdk from .ron file --- unreal-sdk/src/sdk/process.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unreal-sdk/src/sdk/process.rs b/unreal-sdk/src/sdk/process.rs index c806bd7..20b4c7f 100644 --- a/unreal-sdk/src/sdk/process.rs +++ b/unreal-sdk/src/sdk/process.rs @@ -66,6 +66,13 @@ impl Sdk { .and_then(|text| std::fs::write(path, text).context("failed to write to file.")) } + pub fn from_path_ron>(path: P) -> anyhow::Result { + let contents = std::fs::read(path)?; + let new = ron::de::from_bytes::(&contents)?; + + Ok(new) + } + pub fn get_object(&self, key: &ObjectRef) -> Option<&UnrealType> { self.packages .get(&key.package)