mirror of
https://github.com/talwat/lowfi
synced 2025-12-01 12:37:52 +00:00
fix: don't crash if bookmarks.txt is missing
this was a one line fix that i just completely forgot about whilst improving the bookmarking system. i feel very, very stupid.
This commit is contained in:
parent
05fe8069ea
commit
66f2243b2c
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1508,7 +1508,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lowfi"
|
name = "lowfi"
|
||||||
version = "1.7.1"
|
version = "1.7.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"atomic_float",
|
"atomic_float",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lowfi"
|
name = "lowfi"
|
||||||
version = "1.7.1"
|
version = "1.7.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "An extremely simple lofi player."
|
description = "An extremely simple lofi player."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@ -39,9 +39,10 @@ impl Bookmarks {
|
|||||||
|
|
||||||
Ok(data_dir.join("bookmarks.txt"))
|
Ok(data_dir.join("bookmarks.txt"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads bookmarks from the `bookmarks.txt` file.
|
/// Loads bookmarks from the `bookmarks.txt` file.
|
||||||
pub async fn load() -> eyre::Result<Self, BookmarkError> {
|
pub async fn load() -> eyre::Result<Self, BookmarkError> {
|
||||||
let text = fs::read_to_string(Self::path().await?).await?;
|
let text = fs::read_to_string(Self::path().await?).await.unwrap_or_default();
|
||||||
|
|
||||||
let lines: Vec<String> = text
|
let lines: Vec<String> = text
|
||||||
.trim_start_matches("noheader")
|
.trim_start_matches("noheader")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user