mirror of
https://github.com/qwjyh/xdbm
synced 2024-12-05 04:51:04 +09:00
fix: sub directory decision logic on windows
Diff of "C:\foo" from "D:\" is "C:\foo" and doesn't contain "..". In old logic, "C:\foo" is treated as subpath of "D:\" but this is not intuitive.
This commit is contained in:
parent
dbc0d78f99
commit
ced354bf58
1 changed files with 5 additions and 1 deletions
|
@ -135,7 +135,11 @@ fn parent_backups<'a>(
|
|||
trace!("{:?}", backup_path.components());
|
||||
let diff = pathdiff::diff_paths(&target_path, backup_path.clone())?;
|
||||
trace!("Backup: {:?}, Diff: {:?}", backup_path, diff);
|
||||
if diff.components().any(|c| c == path::Component::ParentDir) {
|
||||
// note: Should `RootDir` is included in this list?
|
||||
if diff
|
||||
.components()
|
||||
.any(|c| matches!(c, path::Component::ParentDir | path::Component::Prefix(_)))
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some((backup, diff))
|
||||
|
|
Loading…
Reference in a new issue