Version numbers are kept as strings.

Fixes #220.
This commit is contained in:
WrinklyNinja
2014-08-20 13:38:25 +01:00
parent 56fe71cb87
commit 193c72daeb
+3 -2
View File
@@ -64,9 +64,10 @@ namespace loot {
boost::replace_all(json, "\": ~", "\": null");
// Using the definition at <http://www.json.org/>.
std::regex numbers("\": \"(-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)\"", std::regex::ECMAScript);
// Version numbers should be kept as strings though.
std::regex numbers("\"(?!version)(\\w+)\": \"(-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)\"", std::regex::ECMAScript);
json = std::regex_replace(json, numbers, "\": $1");
json = std::regex_replace(json, numbers, "\"$1\": $2");
return json;
}