mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
feat: prioritize symbolic links when cutting remote files (#3412)
This commit is contained in:
parent
d2e9e72684
commit
9ae8b90d23
11 changed files with 87 additions and 21 deletions
4
yazi-fs/src/provider/capabilities.rs
Normal file
4
yazi-fs/src/provider/capabilities.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Capabilities {
|
||||
pub symlink: bool,
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ use std::{io, path::Path, sync::Arc};
|
|||
use tokio::sync::mpsc;
|
||||
use yazi_shared::{path::{AsPath, PathBufDyn}, scheme::SchemeKind, strand::AsStrand, url::{Url, UrlBuf, UrlCow}};
|
||||
|
||||
use crate::{cha::Cha, path::absolute_url, provider::{Attrs, Provider}};
|
||||
use crate::{cha::Cha, path::absolute_url, provider::{Attrs, Capabilities, Provider}};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Local<'a> {
|
||||
|
|
@ -25,6 +25,9 @@ impl<'a> Provider for Local<'a> {
|
|||
tokio::fs::canonicalize(self.path).await.map(Into::into)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn capabilities(&self) -> Capabilities { Capabilities { symlink: true } }
|
||||
|
||||
async fn casefold(&self) -> io::Result<UrlBuf> {
|
||||
super::casefold(self.path).await.map(Into::into)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
yazi_macro::mod_pub!(local);
|
||||
|
||||
yazi_macro::mod_flat!(attrs traits);
|
||||
yazi_macro::mod_flat!(attrs capabilities traits);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use tokio::{io::{AsyncRead, AsyncSeek, AsyncWrite, AsyncWriteExt}, sync::mpsc};
|
|||
use yazi_macro::ok_or_not_found;
|
||||
use yazi_shared::{path::{AsPath, PathBufDyn}, strand::{AsStrand, StrandCow}, url::{AsUrl, Url, UrlBuf}};
|
||||
|
||||
use crate::{cha::{Cha, ChaType}, provider::Attrs};
|
||||
use crate::{cha::{Cha, ChaType}, provider::{Attrs, Capabilities}};
|
||||
|
||||
pub trait Provider: Sized {
|
||||
type File: AsyncRead + AsyncSeek + AsyncWrite + Unpin;
|
||||
|
|
@ -17,6 +17,8 @@ pub trait Provider: Sized {
|
|||
|
||||
fn canonicalize(&self) -> impl Future<Output = io::Result<UrlBuf>>;
|
||||
|
||||
fn capabilities(&self) -> Capabilities;
|
||||
|
||||
fn casefold(&self) -> impl Future<Output = io::Result<UrlBuf>>;
|
||||
|
||||
fn copy<P>(&self, to: P, attrs: Attrs) -> impl Future<Output = io::Result<u64>>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue