Skip to content

Commit

Permalink
Refactor path handling in source_files processing
Browse files Browse the repository at this point in the history
This commit simplifies the path handling for elements in the source_files array by removing unnecessary path expansions and calculations. Since all paths in source_files are already absolute, this change:
- Eliminates redundant operations such as expand_path.
- Removes unnecessary relative path calculations that merely reconstruct the original paths.

These improvements make the code more efficient and easier to maintain, reducing the potential for path-related errors and enhancing performance.
  • Loading branch information
shinokaro committed Jun 17, 2024
1 parent c89e703 commit 20c1341
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bin/ocran
Original file line number Diff line number Diff line change
@@ -648,15 +648,12 @@ EOF
builder.extend(BuildHelper)
# Recompute the src_prefix. Files may have been added implicitly
# while scanning through features.
files = source_files.map(&:expand_path)
src_prefix = find_src_prefix(files)
src_files = files.map { |file| file.relative_path_from(src_prefix) }
src_prefix = find_src_prefix(source_files)

# Add explicitly mentioned files
Ocran.msg "Adding user-supplied source files"
target_script = nil
src_files.each do |file|
file = src_prefix / file
source_files.each do |file|
if file.subpath?(exec_prefix)
target = file.relative_path_from(exec_prefix)
elsif file.subpath?(src_prefix)

0 comments on commit 20c1341

Please sign in to comment.