mirror of
https://github.com/qwjyh/xdbm
synced 2025-04-18 18:55:51 +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());
|
trace!("{:?}", backup_path.components());
|
||||||
let diff = pathdiff::diff_paths(&target_path, backup_path.clone())?;
|
let diff = pathdiff::diff_paths(&target_path, backup_path.clone())?;
|
||||||
trace!("Backup: {:?}, Diff: {:?}", backup_path, diff);
|
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
|
None
|
||||||
} else {
|
} else {
|
||||||
Some((backup, diff))
|
Some((backup, diff))
|
||||||
|
|
Loading…
Add table
Reference in a new issue