mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
feat: encode SFTP paths on Windows in a revised WTF-8 (#3238)
This commit is contained in:
parent
554cb52cc5
commit
c68e2df8c0
81 changed files with 1393 additions and 459 deletions
|
|
@ -3,7 +3,7 @@ use std::{ffi::OsString, io};
|
|||
use tokio::{select, sync::{mpsc, oneshot}};
|
||||
use yazi_fs::cha::Cha;
|
||||
use yazi_macro::ok_or_not_found;
|
||||
use yazi_shared::url::{AsUrl, UrlBuf, UrlLike};
|
||||
use yazi_shared::url::{AsUrl, Url, UrlBuf, UrlLike};
|
||||
|
||||
use crate::provider;
|
||||
|
||||
|
|
@ -63,23 +63,27 @@ async fn _unique_name(mut url: UrlBuf, append: bool) -> io::Result<UrlBuf> {
|
|||
Ok(url)
|
||||
}
|
||||
|
||||
pub fn copy_with_progress(
|
||||
from: &UrlBuf,
|
||||
to: &UrlBuf,
|
||||
cha: Cha,
|
||||
) -> mpsc::Receiver<Result<u64, io::Error>> {
|
||||
pub fn copy_with_progress<U, V>(from: U, to: V, cha: Cha) -> mpsc::Receiver<Result<u64, io::Error>>
|
||||
where
|
||||
U: AsUrl,
|
||||
V: AsUrl,
|
||||
{
|
||||
_copy_with_progress(from.as_url(), to.as_url(), cha)
|
||||
}
|
||||
|
||||
fn _copy_with_progress(from: Url, to: Url, cha: Cha) -> mpsc::Receiver<Result<u64, io::Error>> {
|
||||
let (prog_tx, prog_rx) = mpsc::channel(1);
|
||||
let (done_tx, mut done_rx) = oneshot::channel();
|
||||
|
||||
tokio::spawn({
|
||||
let (from, to) = (from.clone(), to.clone());
|
||||
let (from, to) = (from.to_owned(), to.to_owned());
|
||||
async move {
|
||||
done_tx.send(provider::copy(&from, &to, cha).await).ok();
|
||||
done_tx.send(provider::copy(from, to, cha).await).ok();
|
||||
}
|
||||
});
|
||||
|
||||
tokio::spawn({
|
||||
let (prog_tx, to) = (prog_tx.clone(), to.clone());
|
||||
let (prog_tx, to) = (prog_tx.to_owned(), to.to_owned());
|
||||
async move {
|
||||
let mut last = 0;
|
||||
let mut done = None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue