Skip to content

Commit 4e3ac54

Browse files
authored
feat: new yazi-vfs crate (#3187)
1 parent 30c0279 commit 4e3ac54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+922
-278
lines changed

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

yazi-actor/src/cmp/trigger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{ffi::OsString, mem, path::MAIN_SEPARATOR_STR};
22

33
use anyhow::Result;
4-
use yazi_fs::{CWD, path::expand_url, provider};
4+
use yazi_fs::{CWD, path::expand_url, provider::{self, DirReader, FileHolder}};
55
use yazi_macro::{act, render, succ};
66
use yazi_parser::cmp::{CmpItem, ShowOpt, TriggerOpt};
77
use yazi_proxy::CmpProxy;
@@ -45,7 +45,7 @@ impl Actor for Trigger {
4545
cache.push(CmpItem { name: OsString::new(), is_dir: true });
4646
}
4747

48-
while let Ok(Some(ent)) = dir.next_entry().await {
48+
while let Ok(Some(ent)) = dir.next().await {
4949
if let Ok(ft) = ent.file_type().await {
5050
cache.push(CmpItem { name: ent.name().into_owned(), is_dir: ft.is_dir() });
5151
}

yazi-actor/src/mgr/bulk_rename.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Actor for BulkRename {
4949
.write_all(old.join(OsStr::new("\n")).as_encoded_bytes())
5050
.await?;
5151

52-
defer! { tokio::spawn(Local::remove_file(tmp.clone())); }
52+
defer! { tokio::spawn(Local.remove_file(tmp.clone())); }
5353
TasksProxy::process_exec(Cow::Borrowed(opener), cwd, vec![
5454
OsString::new(),
5555
tmp.to_owned().into(),
@@ -60,7 +60,8 @@ impl Actor for BulkRename {
6060
defer!(AppProxy::resume());
6161
AppProxy::stop().await;
6262

63-
let new: Vec<_> = Local::read_to_string(&tmp)
63+
let new: Vec<_> = Local
64+
.read_to_string(&tmp)
6465
.await?
6566
.lines()
6667
.take(old.len())

yazi-adapter/src/image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Image {
3939
})
4040
.await??;
4141

42-
Ok(Local::write(cache, buf).await?)
42+
Ok(Local.write(cache, buf).await?)
4343
}
4444

4545
pub(super) async fn downscale(path: &Path, rect: Rect) -> Result<DynamicImage> {

yazi-boot/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ yazi-config = { path = "../yazi-config", version = "25.9.15" }
1414
yazi-fs = { path = "../yazi-fs", version = "25.9.15" }
1515
yazi-macro = { path = "../yazi-macro", version = "25.9.15" }
1616
yazi-shared = { path = "../yazi-shared", version = "25.9.15" }
17+
yazi-vfs = { path = "../yazi-vfs", version = "25.9.15" }
1718

1819
# External dependencies
1920
clap = { workspace = true }

yazi-boot/src/actions/clear_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use yazi_config::YAZI;
2-
use yazi_fs::Xdg;
2+
use yazi_vfs::local::Xdg;
33

44
use super::Actions;
55

yazi-boot/src/boot.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use std::path::PathBuf;
33
use futures::executor::block_on;
44
use hashbrown::HashSet;
55
use serde::Serialize;
6-
use yazi_fs::{CWD, Xdg, path::expand_url, provider};
6+
use yazi_fs::{CWD, path::expand_url, provider};
77
use yazi_shared::url::{UrlBuf, UrnBuf};
8+
use yazi_vfs::local::Xdg;
89

910
#[derive(Debug, Default, Serialize)]
1011
pub struct Boot {

yazi-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ yazi-dds = { path = "../yazi-dds", version = "25.9.15" }
2424
yazi-fs = { path = "../yazi-fs", version = "25.9.15" }
2525
yazi-macro = { path = "../yazi-macro", version = "25.9.15" }
2626
yazi-shared = { path = "../yazi-shared", version = "25.9.15" }
27+
yazi-vfs = { path = "../yazi-vfs", version = "25.9.15" }
2728

2829
# External dependencies
2930
anyhow = { workspace = true }

yazi-cli/src/package/delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Dependency {
2323

2424
pub(super) async fn delete_assets(&self) -> Result<()> {
2525
let assets = self.target().join("assets");
26-
match Local::read_dir(&assets).await {
26+
match Local.read_dir(&assets).await {
2727
Ok(mut it) => {
2828
while let Some(entry) = it.next().await? {
2929
remove_sealed(&entry.path())
@@ -49,7 +49,7 @@ impl Dependency {
4949
.with_context(|| format!("failed to delete `{}`", path.display()))?;
5050
}
5151

52-
if ok_or_not_found(Local::remove_dir(&dir).await).is_ok() {
52+
if ok_or_not_found(Local.remove_dir(&dir).await).is_ok() {
5353
outln!("Done!")?;
5454
} else {
5555
outln!(

yazi-cli/src/package/dependency.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use std::{io::BufWriter, path::{Path, PathBuf}, str::FromStr};
33
use anyhow::{Result, bail};
44
use serde::{Deserialize, Deserializer, Serialize, Serializer};
55
use twox_hash::XxHash3_128;
6-
use yazi_fs::{Xdg, provider::{DirReader, FileHolder, Provider, local::Local}};
6+
use yazi_fs::provider::{DirReader, FileHolder, Provider, local::Local};
77
use yazi_shared::BytesExt;
8+
use yazi_vfs::local::Xdg;
89

910
#[derive(Clone, Default)]
1011
pub(crate) struct Dependency {
@@ -62,7 +63,7 @@ impl Dependency {
6263
}
6364

6465
pub(super) async fn plugin_files(dir: &Path) -> std::io::Result<Vec<String>> {
65-
let mut it = Local::read_dir(dir).await?;
66+
let mut it = Local.read_dir(dir).await?;
6667
let mut files: Vec<String> =
6768
["LICENSE", "README.md", "main.lua"].into_iter().map(Into::into).collect();
6869
while let Some(entry) = it.next().await? {

0 commit comments

Comments
 (0)