1
0
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:
Emil Ernerfeldt
2020-10-19 20:25:05 +02:00
parent 43813a71eb
commit 8ccc36937f
5 changed files with 40 additions and 25 deletions

View File

@@ -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;
}
}
}
// ----------------------------------------------------------------------------