CS3502/project3/src/main.rs
2025-12-04 18:03:57 -05:00

28 lines
729 B
Rust

#![feature(iterator_try_collect)]
use std::path::{PathBuf, MAIN_SEPARATOR_STR};
use winit::error::EventLoopError;
use xilem::{EventLoop, WindowOptions, Xilem};
mod app;
mod files;
use app::*;
fn main() -> Result<(), EventLoopError> {
// Get start directory, first available of:
// - Current directory
// - Home directory
// - Filesystem root
let start_dir = std::env::current_dir()
.ok()
.or_else(|| std::env::home_dir())
.unwrap_or_else(|| PathBuf::from(MAIN_SEPARATOR_STR));
// Start GUI app
let app = Xilem::new_simple(
AppState::new(start_dir),
app_main,
WindowOptions::new("File Manager"),
);
app.run_in(EventLoop::with_user_event())
}