diff --git a/src/main.rs b/src/main.rs index 74c7d0f..78dde37 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,11 @@ mod protostar; use manifest_dir_macros::directory_relative_path; use protostar::ProtoStar; use stardust_xr_molecules::fusion::client::Client; -use std::{env::args, path::PathBuf, str::FromStr}; +use std::{ + env::{args, current_dir}, + path::{Path, PathBuf}, + str::FromStr, +}; #[tokio::main(flavor = "current_thread")] async fn main() { @@ -13,9 +17,10 @@ async fn main() { let _root = client.wrap_root(ProtoStar::new( client.clone(), - PathBuf::from_str(&args().nth(2).unwrap()).unwrap(), 0.1, - PathBuf::from_str(&args().nth(1).unwrap()).unwrap(), + current_dir() + .unwrap() + .join(Path::new(&args().nth(1).unwrap())), )); tokio::select! { diff --git a/src/protostar.rs b/src/protostar.rs index 77f12e4..682a251 100644 --- a/src/protostar.rs +++ b/src/protostar.rs @@ -8,6 +8,7 @@ use stardust_xr_molecules::{ drawable::Model, fields::SphereField, node::NodeType, + resource::NamespacedResource, startup_settings::StartupSettings, }, GrabData, Grabbable, @@ -26,7 +27,7 @@ pub struct ProtoStar { executable_path: PathBuf, } impl ProtoStar { - pub fn new(client: Arc, icon: PathBuf, size: f32, executable_path: PathBuf) -> Self { + pub fn new(client: Arc, size: f32, executable_path: PathBuf) -> Self { let field = SphereField::create(client.get_root(), Vector3::from([0.0; 3]), size * 0.5).unwrap(); let grabbable = Grabbable::new( @@ -42,7 +43,7 @@ impl ProtoStar { let icon = Model::create( grabbable.content_parent(), Transform::from_scale([size; 3]), - &icon, + &NamespacedResource::new("protostar", "default_icon"), ) .unwrap(); ProtoStar {