Fix string range arguments for removing quotes

This commit is contained in:
Douglas Clowes
2014-05-13 17:41:32 +10:00
parent 8d1fed9e68
commit 4e17c8b001

View File

@ -70,11 +70,11 @@ proc config_reader::parse_file {filename} {
set value [string trim [lindex $pair 1] " "] set value [string trim [lindex $pair 1] " "]
# Remove matching quotes on both ends (single, double and braces) # Remove matching quotes on both ends (single, double and braces)
if { [string index $value 0] == "'" && [string index $value end] == "'" } { if { [string index $value 0] == "'" && [string index $value end] == "'" } {
set value [string range 1 end-1] set value [string range $value 1 end-1]
} elseif { [string index $value 0] == "\"" && [string index $value end] == "\"" } { } elseif { [string index $value 0] == "\"" && [string index $value end] == "\"" } {
set value [string range 1 end-1] set value [string range $value 1 end-1]
} elseif { [string index $value 0] == "{" && [string index $value end] == "}" } { } elseif { [string index $value 0] == "{" && [string index $value end] == "}" } {
set value [string range 1 end-1] set value [string range $value 1 end-1]
} }
config_reader::set_var dictionary $cursection $name $value config_reader::set_var dictionary $cursection $name $value
} }