From aa05f54fea3430bd7d8c87a6d696c8d53c18548c Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Sun, 7 Apr 2024 16:37:54 -0400 Subject: [PATCH] test --- src/path.rs | 4 ++++ src/resource/config.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/path.rs b/src/path.rs index d8c8f5e..06bee29 100644 --- a/src/path.rs +++ b/src/path.rs @@ -642,6 +642,8 @@ impl StrictPath { } pub fn nearest_prefix(&self, others: Vec) -> Option { + println!(":: nearest_prefix"); + dbg!((&self, &others)); let (us_drive, us_parts) = self.analyze(); let us_count = us_parts.len(); @@ -651,6 +653,8 @@ impl StrictPath { let (them_drive, them_parts) = other.analyze(); let them_len = them_parts.len(); + dbg!((&us_drive, &us_parts, &them_drive, &them_parts)); + if us_drive != them_drive || us_count <= them_len { continue; } diff --git a/src/resource/config.rs b/src/resource/config.rs index 30cfa87..c8e3736 100644 --- a/src/resource/config.rs +++ b/src/resource/config.rs @@ -1269,8 +1269,10 @@ impl ToggledPaths { } pub fn is_ignored(&self, game: &str, path: &StrictPath) -> bool { + println!(":: is_ignored"); let transitive = self.is_enabled_transitively(game, path); let specific = self.is_enabled_specifically(game, path); + dbg!((game, path, transitive, specific)); match (transitive, specific) { (_, Some(x)) => !x, (Some(x), _) => !x, @@ -1279,6 +1281,7 @@ impl ToggledPaths { } fn is_enabled_transitively(&self, game: &str, path: &StrictPath) -> Option { + println!(":: is_enabled_transitively"); self.0.get(game).and_then(|x| { path.nearest_prefix(x.keys().cloned().collect()) .as_ref() @@ -1287,11 +1290,15 @@ impl ToggledPaths { } fn is_enabled_specifically(&self, game: &str, path: &StrictPath) -> Option { + println!(":: is_enabled_specifically"); self.0.get(game).and_then(|x| match x.get(path) { Some(enabled) => Some(*enabled), None => x .iter() - .find(|(k, _)| path.interpret() == k.interpret()) + .find(|(k, _)| { + dbg!((path.interpret(), k.interpret())); + path.interpret() == k.interpret() + }) .map(|(_, v)| *v), }) }