Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/fosslight_binary/binary_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def get_file_list(path_to_find, abs_path_to_exclude):
return file_cnt, bin_list, found_jar


def get_basename(path):
if path.endswith(os.sep):
path = path[:-1]
return os.path.basename(path)


def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=False,
correct_mode=True, correct_filepath="", path_to_exclude=[]):
global start_time, _root_path, _result_log
Expand All @@ -200,8 +206,9 @@ def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=F
writing_msg = ""
results = []
bin_list = []
base_dir_name = get_basename(path_to_find_bin)
scan_item = ScannerItem(PKG_NAME, "")
abs_path_to_exclude = [os.path.abspath(path) for path in path_to_exclude if path.strip() != ""]
abs_path_to_exclude = [os.path.abspath(os.path.join(base_dir_name, path)) for path in path_to_exclude if path.strip() != ""]

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