Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Gemfile.lock
pkg
.bundle
xcuserdata
!._*
8 changes: 8 additions & 0 deletions lib/fui/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def unused_references(&block)

private

def fix_encoding(file_contents)
file_contents.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
end

# Find all files for which the block yields.
def find(path)
results = []
Expand Down Expand Up @@ -89,6 +93,10 @@ def process_code(references, path)
headers.each do |header|
filename_without_extension = File.basename(path, File.extname(path))
file_contents = File.read(file)
unless file_contents.valid_encoding?
puts "Invalid encoding for #{filename_without_extension}" if options[:verbose]
file_contents = fix_encoding(file_contents)
end
global_import_exists = global_imported(file_contents, header)
local_import_exists = local_imported(file_contents, header)
references[header] << path if filename_without_extension != header.filename_without_extension && (local_import_exists || global_import_exists)
Expand Down
2 changes: 1 addition & 1 deletion lib/fui/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def bridging_headers(verbose)

path_tokens = tokens[1].split('/')
bridging_header = path_tokens[path_tokens.length - 1]
puts "Bridging Header Found: #{bridging_header} in #{project_path}." if verbose
puts "Bridging Header Found: #{bridging_header} in #{path}." if verbose
bridging_headers << bridging_header
end
bridging_headers.uniq
Expand Down
Binary file added spec/fixtures/m/._MyProjectTests.m
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/fixtures/m/unused_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
// FUI
//

@interface UnusedClass
@interface UnusedClass\xAD

@end