File dialog window (a.k.a. file picker) for egui

Crates.io docs.rs Dependency status

Taken from the Dotrix project, made into a stand-alone library and modified for more use cases.

Screenshot from 2022-08-18 07-41-11

Example

toml [dependencies] egui_file = "0.9" eframe = "0.22"

````rust use eframe::{ egui::{CentralPanel, Context}, App, Frame, }; use egui_file::FileDialog; use std::path::PathBuf;

[derive(Default)]

pub struct Demo { openedfile: Option, openfile_dialog: Option, }

impl App for Demo { fn update(&mut self, ctx: &Context, frame: &mut Frame) { CentralPanel::default().show(ctx, |ui| { if (ui.button("Open")).clicked() { let mut dialog = FileDialog::openfile(self.openedfile.clone()); dialog.open(); self.openfile_dialog = Some(dialog); }

  if let Some(dialog) = &mut self.open_file_dialog {
    if dialog.show(ctx).selected() {
      if let Some(file) = dialog.path() {
        self.opened_file = Some(file);
      }
    }
  }
});

} }

fn main() { eframe::runnative( "File Dialog Demo", eframe::NativeOptions::default(), Box::new(|cc| Box::new(Demo::default())), ); } ````