Make image-groups map in export.cfg ordered

This improves the VCS experience because otherwise they change their order everytime producing spurious changes.
This commit is contained in:
Pedro J. Estébanez 2017-01-16 19:00:48 +01:00
parent b351d4cbc1
commit 8e380677cb
1 changed files with 12 additions and 4 deletions

View File

@ -2092,13 +2092,21 @@ void EditorImportExport::save_config() {
if (image_groups.size() && image_group_files.size()){ if (image_groups.size() && image_group_files.size()){
Vector<String> igfsave; Vector<String> igfkeys;
igfsave.resize(image_group_files.size()*2); igfkeys.resize(image_group_files.size());
int idx=0; int idx=0;
for (Map<StringName,StringName>::Element *E=image_group_files.front();E;E=E->next()) { for (Map<StringName,StringName>::Element *E=image_group_files.front();E;E=E->next()) {
igfkeys[idx++]=E->key();
}
igfkeys.sort();
igfsave[idx++]=E->key(); Vector<String> igfsave;
igfsave[idx++]=E->get(); igfsave.resize(image_group_files.size()*2);
idx=0;
for (int i=0;i<igfkeys.size();++i) {
igfsave[idx++]=igfkeys[i];
igfsave[idx++]=image_group_files[igfkeys[i]];
} }
cf->set_value("image_group_files","files",igfsave); cf->set_value("image_group_files","files",igfsave);
} }