feat(startup): get environment

This commit is contained in:
Nova
2023-04-24 09:53:20 -04:00
parent 5682718713
commit 63ead46a2c
3 changed files with 40 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ use self::core::eventloop::EventLoop;
use clap::Parser;
use color_eyre::eyre::Result;
use directories::ProjectDirs;
use once_cell::sync::OnceCell;
use stardust_xr::server;
use std::path::PathBuf;
use std::process::Command;
@@ -52,6 +53,8 @@ struct CliArgs {
startup_script: Option<PathBuf>,
}
static STARDUST_INSTANCE: OnceCell<String> = OnceCell::new();
struct EventLoopInfo {
tokio_handle: Handle,
socket_path: PathBuf,
@@ -259,6 +262,7 @@ async fn event_loop(
) -> color_eyre::eyre::Result<()> {
let socket_path =
server::get_free_socket_path().expect("Unable to find a free stardust socket path");
STARDUST_INSTANCE.set(socket_path.file_name().unwrap().to_string_lossy().into_owned()).expect("Someone hasn't done their job, yell at Nova because how is this set multiple times what the hell");
let _event_loop = EventLoop::new(socket_path.clone()).expect("Couldn't create server socket");
info!("Init event loop");
info!(