diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/config.rs b/src/config.rs index 98140e6..48e4323 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,8 +6,7 @@ use std::sync::Arc; use iced_material::Theme; use serde::{Deserialize, Serialize}; -use tokio_stream::StreamExt; -use tokio_stream::wrappers::ReadDirStream; +use smol::fs; use crate::appearance::Appearance; use crate::{Error, environment}; @@ -63,8 +62,6 @@ impl Config { } pub async fn load() -> Result<Self, Error> { - use tokio::fs; - let path = Self::config_file_path(); if !path.try_exists()? { Self::default() @@ -94,7 +91,7 @@ impl Config { pub async fn load_appearance( theme_name: &str, ) -> Result<Appearance, Error> { - use tokio::fs; + use smol::stream::StreamExt; let read_entry = async move |entry: fs::DirEntry| { let content = fs::read_to_string(entry.path()).await.ok()?; @@ -113,8 +110,7 @@ impl Config { selected = Theme::ALL[index].clone(); } - let mut stream = - ReadDirStream::new(fs::read_dir(Self::themes_dir()).await?); + let mut stream = fs::read_dir(Self::themes_dir()).await?; while let Some(entry) = stream.next().await { let Ok(entry) = entry else { continue; @@ -135,8 +131,7 @@ impl Config { } pub async fn save(self) -> Result<(), Error> { - use tokio::fs; - use tokio::io::AsyncWriteExt; + use smol::io::AsyncWriteExt; let mut file = fs::File::create(Self::config_file_path()).await?; |
