feat: starting page
This commit is contained in:
parent
9000399c7c
commit
e4ddc86caf
6 changed files with 674 additions and 14 deletions
26
src/db.rs
Normal file
26
src/db.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use std::{fs, io};
|
||||
|
||||
pub fn get_last_opened() -> io::Result<String> {
|
||||
Ok(fs::read_to_string(
|
||||
dirs::data_dir()
|
||||
.ok_or(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"unable to find data_dir",
|
||||
))?
|
||||
.join("keepice.txt"),
|
||||
)?)
|
||||
}
|
||||
|
||||
pub fn set_last_opened(path: impl AsRef<str>) -> io::Result<()> {
|
||||
fs::write(
|
||||
dirs::data_dir()
|
||||
.ok_or(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"unable to find data_dir",
|
||||
))?
|
||||
.join("keepice.txt"),
|
||||
path.as_ref(),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Reference in a new issue