26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/firefox/profile_index.rb', line 26
def load()
sections = []
section = nil
File.open(@path).each do |line|
if line.match(/^\[([^\]]+)\]/)
title = $1
next if title == 'General'
section = {}
sections << section
elsif !section.nil? && line.match(/^([^=]+)\s*=\s*(.*)/)
key = $1
value = $2
section[key] = value
end
end
profiles = {}
sections.each do |section|
name = section['Name']
path = Pathname.new(section['Path'])
is_relative = section['IsRelative']
if is_relative == '1'
path = ROOT_PATH.join(path)
end
profile = Profile.new(name, path)
profiles[name] = profile
end
@profiles = profiles
end
|