lib/rim/rim_info.rb in esr-rim-1.1.5 vs lib/rim/rim_info.rb in esr-rim-1.2.0

- old
+ new

@@ -49,35 +49,37 @@ def self.from_s(content) mi = self.new mi.from_s(content) mi end - + + def dirty? + @dirty + end + def from_s(content) attrs = {} # normalize line endings # this way riminfo files will be valid even if line endings are changed content = content.gsub("\r\n", "\n") checksum = content[0..39] # exclude \n after checksum content = content[41..-1] - if content && checksum == calc_sha1(content) + if content content.split("\n").each do |l| col = l.index(":") if col name, value = l[0..col-1], l[col+1..-1] if name && value attrs[name.strip.to_sym] = value.strip end end end - else - # checksum error, ignore content - # TODO: output user warning end AttrsDef.each do |a| send("#{a}=".to_sym, attrs[a]) end + @dirty = checksum != calc_sha1(content) end def from_dir(dir) file = RimInfo.info_file(dir) if File.exist?(file)