Fetch avatar and logs from current_dir instead of static path

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-03-23 21:39:44 +01:00
parent 4eccb02c19
commit 48c4e7b4a7
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -191,9 +191,10 @@ async fn do_main() -> io::Result<()> {
.queue(terminal::DisableLineWrap)? .queue(terminal::DisableLineWrap)?
.queue(crossterm::event::EnableBracketedPaste)? .queue(crossterm::event::EnableBracketedPaste)?
.queue(terminal::Clear(terminal::ClearType::All))?; .queue(terminal::Clear(terminal::ClearType::All))?;
let image = image::open("/home/linkmauve/avatar.png").unwrap(); let current_dir = std::env::current_dir()?;
let image = image::open(current_dir.join("avatar.png")).unwrap();
render_image(image, 16, 16)?; render_image(image, 16, 16)?;
let mut file = std::fs::File::open("/home/linkmauve/logs.log")?; let mut file = std::fs::File::open(current_dir.join("logs.log"))?;
let mut data = String::new(); let mut data = String::new();
file.read_to_string(&mut data)?; file.read_to_string(&mut data)?;
let logs = logger::parse_logs(&data).unwrap().1; let logs = logger::parse_logs(&data).unwrap().1;