Skip to content

Commit e7d67a3

Browse files
authored
Merge pull request #218 from fosslight/win_bug
Fix pkg dir exclude bug for windows
2 parents 5ea3d72 + 796503c commit e7d67a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/fosslight_source/_scan_item.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,13 @@ def is_manifest_file(file_path: str) -> bool:
151151

152152

153153
def is_package_dir(dir_path: str) -> bool:
154-
path_parts = dir_path.split(os.path.sep)
154+
# scancode and scanoss use '/' as path separator regardless of OS
155+
dir_path = dir_path.replace('\\', '/')
156+
path_parts = dir_path.split('/')
157+
155158
for pkg_dir in _package_directory:
156159
if pkg_dir in path_parts:
157160
pkg_index = path_parts.index(pkg_dir)
158-
pkg_path = os.path.sep.join(path_parts[:pkg_index + 1])
161+
pkg_path = '/'.join(path_parts[:pkg_index + 1])
159162
return True, pkg_path
160163
return False, ""

0 commit comments

Comments
 (0)