feat: remove support for older data
This commit is contained in:
parent
90ddb63daf
commit
65dfe4c229
1 changed files with 3 additions and 9 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -64,15 +64,9 @@ impl State {
|
|||
if let Ok(str) =
|
||||
fs::read_to_string(data!()).inspect_err(|e| eprintln!("failed to open data file: {e}"))
|
||||
{
|
||||
if let Ok(saved) = ron::de::from_str::<data::Saved>(&str)
|
||||
.inspect_err(|e| eprintln!("failed to read current version of data file: {e}, trying to restore old version"))
|
||||
{
|
||||
state.table = saved.table;
|
||||
state.content = widget::text_editor::Content::with_text(&saved.notes);
|
||||
} else {
|
||||
// try to read it as an older version on error
|
||||
state.table = ron::de::from_str(&str).unwrap();
|
||||
}
|
||||
let saved = ron::de::from_str::<data::Saved>(&str).unwrap();
|
||||
state.table = saved.table;
|
||||
state.content = widget::text_editor::Content::with_text(&saved.notes);
|
||||
}
|
||||
|
||||
state.ok = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue