From 57d0863fddd7369fcedd96952c81804848032c01 Mon Sep 17 00:00:00 2001 From: Nora Zinaeddin Date: Fri, 31 May 2024 12:47:16 +0200 Subject: [PATCH] Support relative paths in the --file option So far, the file option needed a simple but necessary workaround to support relative file paths. With this change, simply entering the filename in the --file option will be sufficient. --- analyzer/codechecker_analyzer/cmd/analyze.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/analyzer/codechecker_analyzer/cmd/analyze.py b/analyzer/codechecker_analyzer/cmd/analyze.py index 969901a0a1..c1c75ccb50 100644 --- a/analyzer/codechecker_analyzer/cmd/analyze.py +++ b/analyzer/codechecker_analyzer/cmd/analyze.py @@ -16,6 +16,7 @@ import shutil import sys from typing import List +from pathlib import Path from tu_collector import tu_collector @@ -891,7 +892,8 @@ def get_affected_file_paths( """ file_paths = [] # Use list to keep the order of the file paths. for file_filter in file_filters: - file_paths.append(file_filter) + file_paths.append(str(Path(file_filter).resolve()) + if '*' not in file_filter else file_filter) if os.path.exists(file_filter) and \ file_filter.endswith(header_file_extensions):