mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-15 20:45:52 +00:00
Create empty dir on send files in local (#9993)
* feat: Add empty dirs on sendfiles * Update connection.rs --------- Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
@@ -751,6 +751,12 @@ async fn handle_fs(
|
||||
use hbb_common::fs::serialize_transfer_job;
|
||||
|
||||
match fs {
|
||||
ipc::FS::ReadEmptyDirs {
|
||||
dir,
|
||||
include_hidden,
|
||||
} => {
|
||||
read_empty_dirs(&dir, include_hidden, tx).await;
|
||||
}
|
||||
ipc::FS::ReadDir {
|
||||
dir,
|
||||
include_hidden,
|
||||
@@ -907,6 +913,26 @@ async fn handle_fs(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "ios")))]
|
||||
async fn read_empty_dirs(dir: &str, include_hidden: bool, tx: &UnboundedSender<Data>) {
|
||||
let path = dir.to_owned();
|
||||
let path_clone = dir.to_owned();
|
||||
|
||||
if let Ok(Ok(fds)) =
|
||||
spawn_blocking(move || fs::get_empty_dirs_recursive(&path, include_hidden)).await
|
||||
{
|
||||
let mut msg_out = Message::new();
|
||||
let mut file_response = FileResponse::new();
|
||||
file_response.set_empty_dirs(ReadEmptyDirsResponse {
|
||||
path: path_clone,
|
||||
empty_dirs: fds,
|
||||
..Default::default()
|
||||
});
|
||||
msg_out.set_file_response(file_response);
|
||||
send_raw(msg_out, tx);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "ios")))]
|
||||
async fn read_dir(dir: &str, include_hidden: bool, tx: &UnboundedSender<Data>) {
|
||||
let path = {
|
||||
|
||||
Reference in New Issue
Block a user