fix: create config directory to resolve package.toml creation error

Create the config directory for Yazi to resolve the issue where
`package.toml` cannot be created when the config directory is missing.
This commit is contained in:
Integral 2025-12-31 15:09:04 +08:00 committed by sxyazi
parent 456b88d660
commit 841957979f
No known key found for this signature in database

View file

@ -4,9 +4,13 @@ use anyhow::Context;
use yazi_fs::Xdg;
pub(super) fn init() -> anyhow::Result<()> {
let root = Xdg::state_dir().join("packages");
std::fs::create_dir_all(&root)
.with_context(|| format!("failed to create packages directory: {root:?}"))?;
let packages_root = Xdg::state_dir().join("packages");
std::fs::create_dir_all(&packages_root)
.with_context(|| format!("failed to create packages directory: {packages_root:?}"))?;
let config_root = Xdg::config_dir();
std::fs::create_dir_all(&config_root)
.with_context(|| format!("failed to create config directory: {config_root:?}"))?;
Ok(())
}