Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caught File.open() exception and print error #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
38 changes: 24 additions & 14 deletions lib/fui/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,36 @@ def global_imported(file_contents, header)
end

def process_code(references, path)
File.open(path) do |file|
yield path if block_given?
headers.each do |header|
filename_without_extension = File.basename(path, File.extname(path))
file_contents = File.read(file)
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)
begin
File.open(path) do |file|
yield path if block_given?
headers.each do |header|
filename_without_extension = File.basename(path, File.extname(path))
file_contents = File.read(file)
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)
end
end
rescue => e
puts "File Process Error: #{e}, Path: #{path}"
exit -1
end
end

def process_xml(references, path)
File.open(path) do |file|
yield path if block_given?
headers.each do |header|
filename_without_extension = File.basename(path, File.extname(path))
check_xibs = !options['ignore-xib-files']
references[header] << path if (check_xibs || filename_without_extension != header.filename_without_extension) && File.read(file).include?("customClass=\"#{header.filename_without_extension}\"")
begin
File.open(path) do |file|
yield path if block_given?
headers.each do |header|
filename_without_extension = File.basename(path, File.extname(path))
check_xibs = !options['ignore-xib-files']
references[header] << path if (check_xibs || filename_without_extension != header.filename_without_extension) && File.read(file).include?("customClass=\"#{header.filename_without_extension}\"")
end
end
rescue
puts "File Process Error: #{e}, Path: #{path}"
exit -1
end
end
end
Expand Down