fix: linux <- windows subfolder collepsed

This commit is contained in:
Kingtous 2022-05-20 10:51:13 +08:00
parent b267da2e70
commit c4663ecbf3
3 changed files with 20 additions and 5 deletions

View File

@ -767,6 +767,13 @@ pub fn create_dir(dir: &str) -> ResultType<()> {
Ok(())
}
#[inline]
pub fn transform_windows_path(entries: &mut Vec<FileEntry>) {
for entry in entries {
entry.name = entry.name.replace("\\", "/");
}
}
pub enum DigestCheckResult {
IsSame,
NeedConfirm(FileTransferDigest),

View File

@ -4,9 +4,8 @@ use hbb_common::{
allow_err,
compress::decompress,
config::{Config, LocalConfig},
fs,
fs::{can_enable_overwrite_detection, get_string, new_send_confirm, DigestCheckResult},
get_version_number, log,
fs, log,
fs::{can_enable_overwrite_detection, new_send_confirm, DigestCheckResult, get_string, transform_windows_path},
message_proto::*,
protobuf::Message as _,
rendezvous_proto::ConnType,
@ -662,7 +661,10 @@ impl Connection {
}
Some(message::Union::file_response(fr)) => match fr.union {
Some(file_response::Union::dir(fd)) => {
let entries = fd.entries.to_vec();
let mut entries = fd.entries.to_vec();
if self.session.peer_platform() == "Windows" {
fs::transform_windows_path(&mut entries);
}
let id = fd.id;
self.session.push_event(
"file_dir",

View File

@ -2019,7 +2019,13 @@ impl Remote {
Some(message::Union::file_response(fr)) => {
match fr.union {
Some(file_response::Union::dir(fd)) => {
let entries = fd.entries.to_vec();
let mut entries = fd.entries.to_vec();
#[cfg(not(windows))]
{
if self.handler.peer_platform() == "Windows" {
fs::transform_windows_path(&mut entries);
}
}
let mut m = make_fd(fd.id, &entries, fd.id > 0);
if fd.id <= 0 {
m.set_item("path", fd.path);