diff --git a/dcicutils/file_utils.py b/dcicutils/file_utils.py index 42bb32db6..9c0b0f7ff 100644 --- a/dcicutils/file_utils.py +++ b/dcicutils/file_utils.py @@ -44,11 +44,12 @@ def search_for_file(file: str, directory = str(directory) if not (directory := directory.strip()): continue - if os.path.isfile(directory): + if os.path.isfile(directory := os.path.normpath(directory)): # Allow a file; assume its parent directory was intended. if not (directory := os.path.dirname(directory)): continue - location_pruned.append(directory) + if directory not in location_pruned: + location_pruned.append(directory) location = location_pruned for directory in location: if os.path.exists(os.path.join(directory, file)): @@ -59,8 +60,6 @@ def search_for_file(file: str, files_found.append(file_found) if recursive is True: for directory in location: - if not directory: - continue if not directory.endswith("/**") and not file.startswith("**/"): path = f"{directory}/**/{file}" else: diff --git a/pyproject.toml b/pyproject.toml index e614ae1b8..fb91671ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.8.4.1b18" # TODO: To become 8.8.5 +version = "8.8.4.1b19" # TODO: To become 8.8.5 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"