From ee2e08f98d2a5d16953b3ca2aa556b46e9a68e23 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 11 Dec 2020 13:53:01 +0100 Subject: [PATCH] Fix creating an image resource from JS We allow converting strings to Type::Resource, but we have to provide a Value::Resource then, not Value::String. --- api/sixtyfps-node/native/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/sixtyfps-node/native/lib.rs b/api/sixtyfps-node/native/lib.rs index 4460953e4..f65349a33 100644 --- a/api/sixtyfps-node/native/lib.rs +++ b/api/sixtyfps-node/native/lib.rs @@ -204,7 +204,9 @@ fn to_eval_value<'cx>( Ok(Value::Model(sixtyfps_interpreter::ModelPtr(m))) } }, - Type::Resource => Ok(Value::String(val.to_string(cx)?.value().into())), + Type::Resource => { + Ok(Value::Resource(Resource::AbsoluteFilePath(val.to_string(cx)?.value().into()))) + } Type::Bool => Ok(Value::Bool(val.downcast_or_throw::(cx)?.value())), Type::Object { fields, .. } => { let obj = val.downcast_or_throw::(cx)?;