From fff62558cffdf837b6061ebea57f9149530a50a3 Mon Sep 17 00:00:00 2001 From: Nir Date: Wed, 19 Jun 2024 16:12:29 +0300 Subject: [PATCH] Attempt to fix linux test --- duplicate_files_in_folders/file_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/duplicate_files_in_folders/file_manager.py b/duplicate_files_in_folders/file_manager.py index ee777d0..c8670ef 100644 --- a/duplicate_files_in_folders/file_manager.py +++ b/duplicate_files_in_folders/file_manager.py @@ -99,8 +99,11 @@ def is_allowed_path(self, path: str | Path) -> bool: if not self.allowed_dirs: return True # If allowed_dirs is an empty set, all paths are allowed + # resolve all path parents + path_parents = [p.resolve() for p in path.parents] + # True if the path is in any of the allowed directories - return any(path == allowed_dir or allowed_dir in path.parents for allowed_dir in self.allowed_dirs) + return any(path == allowed_dir or allowed_dir in path_parents for allowed_dir in self.allowed_dirs) def move_file(self, src: str, dst: str) -> bool: """