From 46516dab7444c3af7fa0cb100f57545803898451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Mon, 26 Feb 2024 09:14:04 +0800 Subject: [PATCH] refactor: new `yazi-boot` crate (#728) --- Cargo.lock | 24 +++++++++--- scripts/publish.sh | 1 + yazi-adaptor/src/adaptor.rs | 21 +++++------ yazi-boot/Cargo.toml | 24 ++++++++++++ {yazi-config => yazi-boot}/build.rs | 2 +- .../src/boot => yazi-boot/src}/args.rs | 0 .../src/boot => yazi-boot/src}/boot.rs | 20 ++++++++-- yazi-boot/src/lib.rs | 15 ++++++++ yazi-config/Cargo.toml | 9 ----- yazi-config/src/boot/mod.rs | 5 --- yazi-config/src/lib.rs | 14 ++----- yazi-config/src/preset.rs | 37 +++++++++---------- yazi-config/src/preview/preview.rs | 19 ++-------- yazi-core/Cargo.toml | 1 + yazi-core/src/manager/commands/open.rs | 3 +- yazi-core/src/manager/tabs.rs | 2 +- yazi-fm/Cargo.toml | 1 + yazi-fm/src/app/commands/quit.rs | 2 +- yazi-fm/src/logs.rs | 2 +- yazi-fm/src/main.rs | 6 ++- yazi-plugin/Cargo.toml | 1 + yazi-plugin/src/config.rs | 3 +- yazi-plugin/src/loader.rs | 2 +- yazi-plugin/src/plugin.rs | 2 +- yazi-shared/Cargo.toml | 1 + yazi-shared/src/lib.rs | 2 + {yazi-config => yazi-shared}/src/xdg.rs | 12 +++--- 27 files changed, 135 insertions(+), 96 deletions(-) create mode 100644 yazi-boot/Cargo.toml rename {yazi-config => yazi-boot}/build.rs (96%) rename {yazi-config/src/boot => yazi-boot/src}/args.rs (100%) rename {yazi-config/src/boot => yazi-boot/src}/boot.rs (68%) create mode 100644 yazi-boot/src/lib.rs delete mode 100644 yazi-config/src/boot/mod.rs rename {yazi-config => yazi-shared}/src/xdg.rs (70%) diff --git a/Cargo.lock b/Cargo.lock index f736b4ee..a61f5cae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2684,18 +2684,27 @@ dependencies = [ "yazi-shared", ] +[[package]] +name = "yazi-boot" +version = "0.2.3" +dependencies = [ + "clap", + "clap_complete", + "clap_complete_fig", + "clap_complete_nushell", + "serde", + "vergen", + "yazi-config", + "yazi-shared", +] + [[package]] name = "yazi-config" version = "0.2.3" dependencies = [ "anyhow", "arc-swap", - "clap", - "clap_complete", - "clap_complete_fig", - "clap_complete_nushell", "crossterm", - "dirs", "futures", "glob", "indexmap", @@ -2705,7 +2714,6 @@ dependencies = [ "shell-words", "toml", "validator", - "vergen", "yazi-shared", ] @@ -2732,6 +2740,7 @@ dependencies = [ "tracing", "unicode-width", "yazi-adaptor", + "yazi-boot", "yazi-config", "yazi-plugin", "yazi-scheduler", @@ -2760,6 +2769,7 @@ dependencies = [ "tracing-subscriber", "unicode-width", "yazi-adaptor", + "yazi-boot", "yazi-config", "yazi-core", "yazi-plugin", @@ -2791,6 +2801,7 @@ dependencies = [ "unicode-width", "uzers", "yazi-adaptor", + "yazi-boot", "yazi-config", "yazi-prebuild", "yazi-shared", @@ -2830,6 +2841,7 @@ dependencies = [ "anyhow", "bitflags 2.4.2", "crossterm", + "dirs", "futures", "libc", "parking_lot", diff --git a/scripts/publish.sh b/scripts/publish.sh index dcb6ba0f..8e8d4abe 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,6 +1,7 @@ cargo publish -p yazi-shared cargo publish -p yazi-config cargo publish -p yazi-adaptor +cargo publish -p yazi-boot cargo publish -p yazi-scheduler cargo publish -p yazi-plugin cargo publish -p yazi-core diff --git a/yazi-adaptor/src/adaptor.rs b/yazi-adaptor/src/adaptor.rs index 97c96062..bc8b571d 100644 --- a/yazi-adaptor/src/adaptor.rs +++ b/yazi-adaptor/src/adaptor.rs @@ -1,4 +1,4 @@ -use std::{env, io::{Read, Write}, path::Path, sync::Arc}; +use std::{env, fmt::Display, io::{Read, Write}, path::Path, sync::Arc}; use anyhow::{anyhow, Result}; use crossterm::terminal::{disable_raw_mode, enable_raw_mode}; @@ -197,18 +197,17 @@ impl Adaptor { } } -impl ToString for Adaptor { - fn to_string(&self) -> String { +impl Display for Adaptor { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Kitty => "kitty", - Self::KittyOld => "kitty", - Self::Iterm2 => "iterm2", - Self::Sixel => "sixel", - Self::X11 => "x11", - Self::Wayland => "wayland", - Self::Chafa => "chafa", + Self::Kitty => write!(f, "kitty"), + Self::KittyOld => write!(f, "kitty"), + Self::Iterm2 => write!(f, "iterm2"), + Self::Sixel => write!(f, "sixel"), + Self::X11 => write!(f, "x11"), + Self::Wayland => write!(f, "wayland"), + Self::Chafa => write!(f, "chafa"), } - .to_string() } } diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml new file mode 100644 index 00000000..71854f4b --- /dev/null +++ b/yazi-boot/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "yazi-boot" +version = "0.2.3" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi bootstrapper" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + +[dependencies] +yazi-config = { path = "../yazi-config", version = "0.2.3" } +yazi-shared = { path = "../yazi-shared", version = "0.2.3" } + +# External dependencies +clap = { version = "^4", features = [ "derive" ] } +serde = { version = "^1", features = [ "derive" ] } + +[build-dependencies] +clap = { version = "^4", features = [ "derive" ] } +clap_complete = "^4" +clap_complete_nushell = "^4" +clap_complete_fig = "^4" +vergen = { version = "^8", features = [ "build", "git", "gitcl" ] } diff --git a/yazi-config/build.rs b/yazi-boot/build.rs similarity index 96% rename from yazi-config/build.rs rename to yazi-boot/build.rs index 5b8e7ef3..1112057f 100644 --- a/yazi-config/build.rs +++ b/yazi-boot/build.rs @@ -1,4 +1,4 @@ -#[path = "src/boot/args.rs"] +#[path = "src/args.rs"] mod args; use std::{env, error::Error, fs}; diff --git a/yazi-config/src/boot/args.rs b/yazi-boot/src/args.rs similarity index 100% rename from yazi-config/src/boot/args.rs rename to yazi-boot/src/args.rs diff --git a/yazi-config/src/boot/boot.rs b/yazi-boot/src/boot.rs similarity index 68% rename from yazi-config/src/boot/boot.rs rename to yazi-boot/src/boot.rs index 47ddbcdc..5de5cea0 100644 --- a/yazi-config/src/boot/boot.rs +++ b/yazi-boot/src/boot.rs @@ -2,10 +2,11 @@ use std::{ffi::OsString, fs, path::{Path, PathBuf}, process}; use clap::Parser; use serde::Serialize; -use yazi_shared::fs::{current_cwd, expand_path}; +use yazi_config::PREVIEW; +use yazi_shared::{fs::{current_cwd, expand_path}, Xdg}; use super::Args; -use crate::{Xdg, ARGS}; +use crate::ARGS; #[derive(Debug, Serialize)] pub struct Boot { @@ -29,7 +30,7 @@ impl Boot { return (entry, None); } - return (parent.unwrap().to_owned(), Some(entry.file_name().unwrap().to_owned())); + (parent.unwrap().to_owned(), Some(entry.file_name().unwrap().to_owned())) } } @@ -67,6 +68,19 @@ impl Default for Args { process::exit(0); } + if args.clear_cache { + if PREVIEW.cache_dir == Xdg::cache_dir() { + println!("Clearing cache directory: \n{:?}", PREVIEW.cache_dir); + fs::remove_dir_all(&PREVIEW.cache_dir).unwrap(); + } else { + println!( + "You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}", + PREVIEW.cache_dir + ); + } + process::exit(0); + } + args } } diff --git a/yazi-boot/src/lib.rs b/yazi-boot/src/lib.rs new file mode 100644 index 00000000..569424dc --- /dev/null +++ b/yazi-boot/src/lib.rs @@ -0,0 +1,15 @@ +use yazi_shared::RoCell; + +mod args; +mod boot; + +pub use args::*; +pub use boot::*; + +pub static ARGS: RoCell = RoCell::new(); +pub static BOOT: RoCell = RoCell::new(); + +pub fn init() { + ARGS.with(Default::default); + BOOT.with(Default::default); +} diff --git a/yazi-config/Cargo.toml b/yazi-config/Cargo.toml index c25461aa..c4b47b04 100644 --- a/yazi-config/Cargo.toml +++ b/yazi-config/Cargo.toml @@ -14,9 +14,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.2.3" } # External dependencies anyhow = "^1" arc-swap = "^1" -clap = { version = "^4", features = [ "derive" ] } crossterm = "^0" -dirs = "^5" futures = "^0" glob = "^0" indexmap = "^2" @@ -26,10 +24,3 @@ serde = { version = "^1", features = [ "derive" ] } shell-words = "^1" toml = { version = "^0", features = [ "preserve_order" ] } validator = { version = "^0", features = [ "derive" ] } - -[build-dependencies] -clap = { version = "^4", features = [ "derive" ] } -clap_complete = "^4" -clap_complete_nushell = "^4" -clap_complete_fig = "^4" -vergen = { version = "^8", features = [ "build", "git", "gitcl" ] } diff --git a/yazi-config/src/boot/mod.rs b/yazi-config/src/boot/mod.rs deleted file mode 100644 index d29db39c..00000000 --- a/yazi-config/src/boot/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod args; -mod boot; - -pub use args::*; -pub use boot::*; diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index cf7826dc..ed53e254 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -2,7 +2,6 @@ use yazi_shared::RoCell; -mod boot; pub mod keymap; mod layout; mod log; @@ -18,16 +17,12 @@ mod tasks; pub mod theme; mod validation; pub mod which; -mod xdg; pub use layout::*; pub(crate) use pattern::*; pub(crate) use preset::*; pub use priority::*; -pub(crate) use xdg::*; -pub static ARGS: RoCell = RoCell::new(); -pub static BOOT: RoCell = RoCell::new(); pub static LAYOUT: RoCell> = RoCell::new(); static MERGED_KEYMAP: RoCell = RoCell::new(); @@ -47,13 +42,12 @@ pub static SELECT: RoCell = RoCell::new(); pub static WHICH: RoCell = RoCell::new(); pub fn init() { - ARGS.with(Default::default); - BOOT.with(Default::default); LAYOUT.with(Default::default); - MERGED_KEYMAP.with(Preset::keymap); - MERGED_THEME.with(Preset::theme); - MERGED_YAZI.with(Preset::yazi); + let config_dir = yazi_shared::Xdg::config_dir().unwrap(); + MERGED_KEYMAP.init(Preset::keymap(&config_dir)); + MERGED_THEME.init(Preset::theme(&config_dir)); + MERGED_YAZI.init(Preset::yazi(&config_dir)); KEYMAP.with(Default::default); LOG.with(Default::default); diff --git a/yazi-config/src/preset.rs b/yazi-config/src/preset.rs index 52427287..e8b916a6 100644 --- a/yazi-config/src/preset.rs +++ b/yazi-config/src/preset.rs @@ -1,25 +1,23 @@ -use std::{fs, mem}; +use std::{mem, path::{Path, PathBuf}}; -use toml::Table; - -use crate::BOOT; +use toml::{Table, Value}; pub(crate) struct Preset; impl Preset { #[inline] - pub(crate) fn keymap() -> String { - Self::merge_str("keymap.toml", include_str!("../preset/keymap.toml")) + pub(crate) fn keymap(dir: &Path) -> String { + Self::merge_str(dir.join("keymap.toml"), include_str!("../preset/keymap.toml")) } #[inline] - pub(crate) fn theme() -> String { - Self::merge_str("theme.toml", include_str!("../preset/theme.toml")) + pub(crate) fn theme(dir: &Path) -> String { + Self::merge_str(dir.join("theme.toml"), include_str!("../preset/theme.toml")) } #[inline] - pub(crate) fn yazi() -> String { - Self::merge_str("yazi.toml", include_str!("../preset/yazi.toml")) + pub(crate) fn yazi(dir: &Path) -> String { + Self::merge_str(dir.join("yazi.toml"), include_str!("../preset/yazi.toml")) } #[inline] @@ -27,10 +25,10 @@ impl Preset { *a = b.into_iter().chain(mem::take(a)).chain(c).collect(); } - fn merge(a: &mut Table, b: &Table, max: u8) { + fn merge(a: &mut Table, b: Table, max: u8) { for (k, v) in b { - let Some(a) = a.get_mut(k) else { - a.insert(k.clone(), v.clone()); + let Some(a) = a.get_mut(&k) else { + a.insert(k, v); continue; }; @@ -39,21 +37,20 @@ impl Preset { } if let Some(a) = a.as_table_mut() { - if let Some(b) = v.as_table() { + if let Value::Table(b) = v { Self::merge(a, b, max - 1); continue; } } - *a = v.clone(); + *a = v; } } - fn merge_str(user: &str, base: &str) -> String { - let path = BOOT.config_dir.join(user); - let mut user = fs::read_to_string(path).unwrap_or_default().parse::().unwrap(); - + fn merge_str(user: PathBuf, base: &str) -> String { + let mut user = std::fs::read_to_string(user).unwrap_or_default().parse::
().unwrap(); let base = base.parse::
().unwrap(); - Self::merge(&mut user, &base, 2); + + Self::merge(&mut user, base, 2); user.to_string() } } diff --git a/yazi-config/src/preview/preview.rs b/yazi-config/src/preview/preview.rs index a6f7e9af..9e3d334c 100644 --- a/yazi-config/src/preview/preview.rs +++ b/yazi-config/src/preview/preview.rs @@ -1,10 +1,10 @@ -use std::{fs, path::PathBuf, process, time::{self, SystemTime}}; +use std::{fs, path::PathBuf, time::{self, SystemTime}}; use serde::{Deserialize, Serialize}; use validator::Validate; -use yazi_shared::fs::expand_path; +use yazi_shared::{fs::expand_path, Xdg}; -use crate::{validation::check_validation, xdg::Xdg, ARGS, MERGED_YAZI}; +use crate::{validation::check_validation, MERGED_YAZI}; #[derive(Debug, Serialize)] pub struct Preview { @@ -56,19 +56,6 @@ impl Default for Preview { fs::create_dir(&cache_dir).unwrap(); } - if ARGS.clear_cache { - if cache_dir == Xdg::cache_dir() { - println!("Clearing cache directory: \n{:?}", cache_dir); - fs::remove_dir_all(&cache_dir).unwrap(); - } else { - println!( - "You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}", - cache_dir - ); - } - process::exit(0); - } - Preview { tab_size: preview.tab_size, max_width: preview.max_width, diff --git a/yazi-core/Cargo.toml b/yazi-core/Cargo.toml index 98d752c2..f6175b7b 100644 --- a/yazi-core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.3" } +yazi-boot = { path = "../yazi-boot", version = "0.2.3" } yazi-config = { path = "../yazi-config", version = "0.2.3" } yazi-plugin = { path = "../yazi-plugin", version = "0.2.3" } yazi-scheduler = { path = "../yazi-scheduler", version = "0.2.3" } diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index f7602e36..bbeab28e 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -1,7 +1,8 @@ use std::ffi::OsString; use tracing::error; -use yazi_config::{popup::SelectCfg, ARGS, OPEN}; +use yazi_boot::ARGS; +use yazi_config::{popup::SelectCfg, OPEN}; use yazi_plugin::isolate; use yazi_shared::{emit, event::{Cmd, EventQuit}, fs::{File, Url}, Layer, MIME_DIR}; diff --git a/yazi-core/src/manager/tabs.rs b/yazi-core/src/manager/tabs.rs index 2cfb8859..fb60b6b8 100644 --- a/yazi-core/src/manager/tabs.rs +++ b/yazi-core/src/manager/tabs.rs @@ -1,6 +1,6 @@ use std::ops::{Deref, DerefMut}; -use yazi_config::BOOT; +use yazi_boot::BOOT; use yazi_shared::fs::Url; use crate::{manager::Manager, tab::Tab}; diff --git a/yazi-fm/Cargo.toml b/yazi-fm/Cargo.toml index 07523196..30e4ac0e 100644 --- a/yazi-fm/Cargo.toml +++ b/yazi-fm/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.3" } +yazi-boot = { path = "../yazi-boot", version = "0.2.3" } yazi-config = { path = "../yazi-config", version = "0.2.3" } yazi-core = { path = "../yazi-core", version = "0.2.3" } yazi-plugin = { path = "../yazi-plugin", version = "0.2.3" } diff --git a/yazi-fm/src/app/commands/quit.rs b/yazi-fm/src/app/commands/quit.rs index 5a772e5b..e4bbf4cb 100644 --- a/yazi-fm/src/app/commands/quit.rs +++ b/yazi-fm/src/app/commands/quit.rs @@ -1,6 +1,6 @@ use std::ffi::OsString; -use yazi_config::ARGS; +use yazi_boot::ARGS; use yazi_shared::{event::EventQuit, term::Term}; use crate::app::App; diff --git a/yazi-fm/src/logs.rs b/yazi-fm/src/logs.rs index 6587e31c..f10d491e 100644 --- a/yazi-fm/src/logs.rs +++ b/yazi-fm/src/logs.rs @@ -1,7 +1,7 @@ use anyhow::{Context, Result}; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt, Registry}; -use yazi_config::BOOT; +use yazi_boot::BOOT; pub(super) struct Logs; diff --git a/yazi-fm/src/main.rs b/yazi-fm/src/main.rs index e025eb8a..041954c9 100644 --- a/yazi-fm/src/main.rs +++ b/yazi-fm/src/main.rs @@ -40,13 +40,15 @@ async fn main() -> anyhow::Result<()> { yazi_config::init(); - yazi_core::init(); + yazi_adaptor::init(); + + yazi_boot::init(); yazi_scheduler::init(); yazi_plugin::init(); - yazi_adaptor::init(); + yazi_core::init(); app::App::run().await } diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml index 36d33a6c..dd8d2fa6 100644 --- a/yazi-plugin/Cargo.toml +++ b/yazi-plugin/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-adaptor = { path = "../yazi-adaptor", version = "0.2.3" } +yazi-boot = { path = "../yazi-boot", version = "0.2.3" } yazi-config = { path = "../yazi-config", version = "0.2.3" } yazi-shared = { path = "../yazi-shared", version = "0.2.3" } diff --git a/yazi-plugin/src/config.rs b/yazi-plugin/src/config.rs index 0571af5d..6f5a5d4c 100644 --- a/yazi-plugin/src/config.rs +++ b/yazi-plugin/src/config.rs @@ -1,5 +1,6 @@ use mlua::{Lua, LuaSerdeExt, SerializeOptions}; -use yazi_config::{BOOT, MANAGER, PREVIEW, THEME}; +use yazi_boot::BOOT; +use yazi_config::{MANAGER, PREVIEW, THEME}; const OPTIONS: SerializeOptions = SerializeOptions::new().serialize_none_to_null(false).serialize_unit_to_null(false); diff --git a/yazi-plugin/src/loader.rs b/yazi-plugin/src/loader.rs index 123e55bd..b8d02b1b 100644 --- a/yazi-plugin/src/loader.rs +++ b/yazi-plugin/src/loader.rs @@ -4,7 +4,7 @@ use anyhow::{bail, Result}; use mlua::{ExternalError, Table}; use parking_lot::RwLock; use tokio::fs; -use yazi_config::BOOT; +use yazi_boot::BOOT; use yazi_shared::RoCell; use crate::LUA; diff --git a/yazi-plugin/src/plugin.rs b/yazi-plugin/src/plugin.rs index 518d9c42..abc30719 100644 --- a/yazi-plugin/src/plugin.rs +++ b/yazi-plugin/src/plugin.rs @@ -1,6 +1,6 @@ use anyhow::Result; use mlua::Lua; -use yazi_config::BOOT; +use yazi_boot::BOOT; use yazi_shared::RoCell; pub static LUA: RoCell = RoCell::new(); diff --git a/yazi-shared/Cargo.toml b/yazi-shared/Cargo.toml index 3f2d49df..52df8e0d 100644 --- a/yazi-shared/Cargo.toml +++ b/yazi-shared/Cargo.toml @@ -12,6 +12,7 @@ repository = "https://github.com/sxyazi/yazi" anyhow = "^1" bitflags = "^2" crossterm = "^0" +dirs = "^5" futures = "^0" parking_lot = "^0" percent-encoding = "^2" diff --git a/yazi-shared/src/lib.rs b/yazi-shared/src/lib.rs index f0d3fa07..465e05fa 100644 --- a/yazi-shared/src/lib.rs +++ b/yazi-shared/src/lib.rs @@ -16,6 +16,7 @@ mod ro_cell; pub mod term; mod throttle; mod time; +mod xdg; pub use chars::*; pub use condition::*; @@ -30,3 +31,4 @@ pub use os::*; pub use ro_cell::*; pub use throttle::*; pub use time::*; +pub use xdg::*; diff --git a/yazi-config/src/xdg.rs b/yazi-shared/src/xdg.rs similarity index 70% rename from yazi-config/src/xdg.rs rename to yazi-shared/src/xdg.rs index ec44c7b6..8b28f54e 100644 --- a/yazi-config/src/xdg.rs +++ b/yazi-shared/src/xdg.rs @@ -1,11 +1,11 @@ use std::{env, path::PathBuf}; -use yazi_shared::fs::expand_path; +use crate::fs::expand_path; -pub(super) struct Xdg; +pub struct Xdg; impl Xdg { - pub(super) fn config_dir() -> Option { + pub fn config_dir() -> Option { if let Some(s) = env::var_os("YAZI_CONFIG_HOME").filter(|s| !s.is_empty()) { return Some(expand_path(s)); } @@ -25,9 +25,9 @@ impl Xdg { } #[inline] - pub(super) fn plugin_dir() -> Option { Self::config_dir().map(|p| p.join("plugins")) } + pub fn plugin_dir() -> Option { Self::config_dir().map(|p| p.join("plugins")) } - pub(super) fn state_dir() -> Option { + pub fn state_dir() -> Option { #[cfg(windows)] { dirs::data_dir().map(|p| p.join("yazi").join("state")) @@ -43,5 +43,5 @@ impl Xdg { } #[inline] - pub(super) fn cache_dir() -> PathBuf { env::temp_dir().join("yazi") } + pub fn cache_dir() -> PathBuf { env::temp_dir().join("yazi") } }