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