feat: identical msg in flutter and sciter
This commit is contained in:
parent
33ca87718b
commit
7a05910807
41 changed files with 71 additions and 18 deletions
|
|
@ -301,6 +301,7 @@ message FileTransferDigest {
|
|||
uint64 last_modified = 3;
|
||||
uint64 file_size = 4;
|
||||
bool is_upload = 5;
|
||||
bool is_identical = 6;
|
||||
}
|
||||
|
||||
message FileTransferBlock {
|
||||
|
|
|
|||
|
|
@ -821,20 +821,21 @@ pub fn is_write_need_confirmation(
|
|||
if path.exists() && path.is_file() {
|
||||
let metadata = std::fs::metadata(path)?;
|
||||
let modified_time = metadata.modified()?;
|
||||
// let remote_mt = Duration::from_secs(digest.last_modified);
|
||||
let remote_mt = Duration::from_secs(digest.last_modified);
|
||||
let local_mt = modified_time.duration_since(UNIX_EPOCH)?;
|
||||
// [Note]
|
||||
// We decide not to compare the file with peers,
|
||||
// We decide to give the decision whether to override the existing file to users,
|
||||
// which obey the behavior of the file manager in our system.
|
||||
//
|
||||
// if remote_mt == local_mt && digest.file_size == metadata.len() {
|
||||
// return Ok(DigestCheckResult::IsSame);
|
||||
// }
|
||||
let mut is_identical = false;
|
||||
if remote_mt == local_mt && digest.file_size == metadata.len() {
|
||||
is_identical = true;
|
||||
}
|
||||
Ok(DigestCheckResult::NeedConfirm(FileTransferDigest {
|
||||
id: digest.id,
|
||||
file_num: digest.file_num,
|
||||
last_modified: local_mt.as_secs(),
|
||||
file_size: metadata.len(),
|
||||
is_identical,
|
||||
..Default::default()
|
||||
}))
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue