diff options
author | est31 <MTest31@outlook.com> | 2015-05-01 02:53:41 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-05-01 03:41:45 +0200 |
commit | b2b514367824263e2dc1e26b010b0df63fd3700a (patch) | |
tree | 8d9ef509c495ceaa25c8a5b34b844fd9c9ed216c /core/io | |
parent | 5c6b31c024b60ae9c43dc48c04128de99d147f5a (diff) |
Sort xml files, so order is constant
Makes xml format work better with version control systems.
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/resource_format_xml.cpp | 8 | ||||
-rw-r--r-- | core/io/resource_format_xml.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 50b1eba6e7..5922d83907 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -2243,12 +2243,12 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V List<Variant> keys; dict.get_key_list(&keys); + keys.sort(); for(List<Variant>::Element *E=keys.front();E;E=E->next()) { //if (!_check_type(dict[E->get()])) // continue; - bool ok; write_property("",E->get(),&ok); ERR_CONTINUE(!ok); @@ -2438,7 +2438,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo return; if (!p_main && (!bundle_resources ) && res->get_path().length() && res->get_path().find("::") == -1 ) { - external_resources.insert(res); + external_resources.push_back(res); return; } @@ -2448,6 +2448,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo List<PropertyInfo> property_list; res->get_property_list( &property_list ); + property_list.sort(); List<PropertyInfo>::Element *I=property_list.front(); @@ -2525,7 +2526,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res enter_tag("resource_file","type=\""+p_resource->get_type()+"\" subresource_count=\""+itos(saved_resources.size()+external_resources.size())+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\""); write_string("\n",false); - for(Set<RES>::Element *E=external_resources.front();E;E=E->next()) { + for(List<RES>::Element *E=external_resources.front();E;E=E->next()) { write_tabs(); String p = E->get()->get_path(); @@ -2562,6 +2563,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res List<PropertyInfo> property_list; res->get_property_list(&property_list); + property_list.sort(); for(List<PropertyInfo>::Element *PE = property_list.front();PE;PE=PE->next()) { diff --git a/core/io/resource_format_xml.h b/core/io/resource_format_xml.h index 8bc29d3f5c..711b607668 100644 --- a/core/io/resource_format_xml.h +++ b/core/io/resource_format_xml.h @@ -125,7 +125,7 @@ class ResourceFormatSaverXMLInstance { int depth; Map<RES,int> resource_map; List<RES> saved_resources; - Set<RES> external_resources; + List<RES> external_resources; void enter_tag(const char* p_tag,const String& p_args=String()); void exit_tag(const char* p_tag); |