From 796503c5ce90de51d035b3ee0deb7370ed312d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9D=EC=A7=80=EC=98=81/=EC=B1=85=EC=9E=84=EC=97=B0?= =?UTF-8?q?=EA=B5=AC=EC=9B=90/SW=EA=B3=B5=ED=95=99=28=EC=97=B0=29Open=20So?= =?UTF-8?q?urce=20TP?= Date: Mon, 1 Dec 2025 16:16:24 +0900 Subject: [PATCH] Fix pkg dir exclude bug for windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 석지영/책임연구원/SW공학(연)Open Source TP --- src/fosslight_source/_scan_item.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fosslight_source/_scan_item.py b/src/fosslight_source/_scan_item.py index 022f843..adb97ed 100644 --- a/src/fosslight_source/_scan_item.py +++ b/src/fosslight_source/_scan_item.py @@ -151,10 +151,13 @@ def is_manifest_file(file_path: str) -> bool: def is_package_dir(dir_path: str) -> bool: - path_parts = dir_path.split(os.path.sep) + # scancode and scanoss use '/' as path separator regardless of OS + dir_path = dir_path.replace('\\', '/') + path_parts = dir_path.split('/') + for pkg_dir in _package_directory: if pkg_dir in path_parts: pkg_index = path_parts.index(pkg_dir) - pkg_path = os.path.sep.join(path_parts[:pkg_index + 1]) + pkg_path = '/'.join(path_parts[:pkg_index + 1]) return True, pkg_path return False, ""