Skip to content

Commit

Permalink
fix shared changed file detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiscosity committed Dec 14, 2024
1 parent c05bf81 commit 9fa9e98
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/pickerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,25 @@ void PickerWidget::gendiff(QString orig_path, QString work_path) {
QFileInfo a(orig_path + "/" + i);
QFileInfo b(work_path + "/" + i);
if (!a.isFile() || !b.isFile()) {
break;
continue;
}
if (a.lastModified() != b.lastModified()){
if (a.size() == b.size()) {
QFile orig_map(orig_path + "/" + i);
QFile work_map(work_path + "/" + i);

QCryptographicHash orig_hash(QCryptographicHash::Md5);
orig_map.open(QFile::OpenMode::fromInt(1));
orig_hash.addData(&orig_map);

QCryptographicHash work_hash(QCryptographicHash::Md5);
work_map.open(QFile::OpenMode::fromInt(1));
work_hash.addData(&work_map);
if (orig_hash.result() == work_hash.result()){
continue;
}
}

shared.push_back(i);
}
}
Expand Down

0 comments on commit 9fa9e98

Please sign in to comment.