fix: errors out if the target package directory doesn't exist previously (#3392)

This commit is contained in:
三咲雅 misaki masa 2025-12-01 11:11:00 +08:00 committed by GitHub
parent d0adb9c015
commit d910104c00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@ use anyhow::{Result, bail};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use twox_hash::XxHash3_128;
use yazi_fs::Xdg;
use yazi_macro::ok_or_not_found;
use yazi_shared::BytesExt;
#[derive(Clone, Default)]
@ -62,7 +63,7 @@ impl Dependency {
}
pub(super) async fn plugin_files(dir: &Path) -> std::io::Result<Vec<String>> {
let mut it = tokio::fs::read_dir(dir).await?;
let mut it = ok_or_not_found!(tokio::fs::read_dir(dir).await, return Ok(vec![]));
let mut files: Vec<String> =
["LICENSE", "README.md", "main.lua"].into_iter().map(Into::into).collect();
while let Some(entry) = it.next_entry().await? {