lib/fit4ruby/FitFile.rb in fit4ruby-0.0.1 vs lib/fit4ruby/FitFile.rb in fit4ruby-0.0.2
- old
+ new
@@ -13,11 +13,10 @@
require 'fit4ruby/Log'
require 'fit4ruby/FitHeader'
require 'fit4ruby/FitRecord'
require 'fit4ruby/FitFilter'
require 'fit4ruby/FitMessageIdMapper'
-require 'fit4ruby/FitFileId'
require 'fit4ruby/GlobalFitMessages'
require 'fit4ruby/GlobalFitDictionaries'
module Fit4Ruby
@@ -30,11 +29,11 @@
def read(file_name, filter = nil)
@file_name = file_name
definitions = {}
begin
io = ::File.open(file_name, 'rb')
- rescue RuntimeError => e
+ rescue StandardError => e
Log.critical("Cannot open FIT file '#{file_name}'", e)
end
header = FitHeader.read(io)
header.check
@@ -73,10 +72,9 @@
header = FitHeader.new
start_pos = header.header_size
# Move the pointer behind the header section.
io.seek(start_pos)
id_mapper = FitMessageIdMapper.new
- FitFileId.new.write(io, id_mapper)
activity.write(io, id_mapper)
end_pos = io.pos
crc = write_crc(io, start_pos, end_pos)