Skip to content

Commit 54c7c6d

Browse files
committed
Modify to exclude path
1 parent 1572bd5 commit 54c7c6d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/fosslight_binary/binary_analysis.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ def get_file_list(path_to_find, abs_path_to_exclude):
175175
return file_cnt, bin_list, found_jar
176176

177177

178+
def get_basename(path):
179+
if path.endswith(os.sep):
180+
path = path[:-1]
181+
return os.path.basename(path)
182+
183+
178184
def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=False,
179185
correct_mode=True, correct_filepath="", path_to_exclude=[]):
180186
global start_time, _root_path, _result_log
@@ -200,8 +206,9 @@ def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=F
200206
writing_msg = ""
201207
results = []
202208
bin_list = []
209+
base_dir_name = get_basename(path_to_find_bin)
203210
scan_item = ScannerItem(PKG_NAME, "")
204-
abs_path_to_exclude = [os.path.abspath(path) for path in path_to_exclude if path.strip() != ""]
211+
abs_path_to_exclude = [os.path.abspath(os.path.join(base_dir_name, path)) for path in path_to_exclude if path.strip() != ""]
205212

206213
if not os.path.isdir(path_to_find_bin):
207214
error_occured(error_msg=f"(-p option) Can't find the directory: {path_to_find_bin}",

0 commit comments

Comments
 (0)