mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
[egui_glium] Add option not to persist app to file
This commit is contained in:
@@ -18,13 +18,6 @@ impl FileStorage {
|
||||
dirty: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn save(&mut self) {
|
||||
if self.dirty {
|
||||
serde_json::to_writer(std::fs::File::create(&self.path).unwrap(), &self.kv).unwrap();
|
||||
self.dirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl egui::app::Storage for FileStorage {
|
||||
@@ -38,6 +31,13 @@ impl egui::app::Storage for FileStorage {
|
||||
self.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&mut self) {
|
||||
if self.dirty {
|
||||
serde_json::to_writer(std::fs::File::create(&self.path).unwrap(), &self.kv).unwrap();
|
||||
self.dirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user