From a8d54fdd7c2c1981e1d4a57c4ddc45d6c4858e83 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 2 Aug 2024 09:20:34 -0700 Subject: [PATCH] minor tweak to loading map from arg --- src/setup.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/setup.rs b/src/setup.rs index 5301cb9..1e39d4e 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -217,9 +217,8 @@ pub fn setup_and_start(title:String){ //the thread that spawns the physics thread let mut window_thread=window.into_worker(setup_context); - let args:Vec=std::env::args().collect(); - if args.len()==2{ - let path=std::path::PathBuf::from(&args[1]); + if let Some(arg)=std::env::args().nth(1){ + let path=std::path::PathBuf::from(arg); window_thread.send(TimedInstruction{ time:integer::Time::ZERO, instruction:WindowInstruction::WindowEvent(winit::event::WindowEvent::DroppedFile(path)),