Merge pull request #4919 from ntruhan/master
Android: Sort configuration ini files
This commit is contained in:
commit
56afabb9a8
|
@ -20,6 +20,7 @@ import java.io.PrintWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains static methods for interacting with .ini files in which settings are stored.
|
* Contains static methods for interacting with .ini files in which settings are stored.
|
||||||
|
@ -322,8 +323,9 @@ public final class SettingsFile
|
||||||
writer = new PrintWriter(ini, "UTF-8");
|
writer = new PrintWriter(ini, "UTF-8");
|
||||||
|
|
||||||
Set<String> keySet = sections.keySet();
|
Set<String> keySet = sections.keySet();
|
||||||
|
Set<String> sortedKeySet = new TreeSet<>(keySet);
|
||||||
|
|
||||||
for (String key : keySet)
|
for (String key : sortedKeySet)
|
||||||
{
|
{
|
||||||
SettingSection section = sections.get(key);
|
SettingSection section = sections.get(key);
|
||||||
writeSection(writer, section);
|
writeSection(writer, section);
|
||||||
|
@ -437,8 +439,9 @@ public final class SettingsFile
|
||||||
// Write this section's values.
|
// Write this section's values.
|
||||||
HashMap<String, Setting> settings = section.getSettings();
|
HashMap<String, Setting> settings = section.getSettings();
|
||||||
Set<String> keySet = settings.keySet();
|
Set<String> keySet = settings.keySet();
|
||||||
|
Set<String> sortedKeySet = new TreeSet<>(keySet);
|
||||||
|
|
||||||
for (String key : keySet)
|
for (String key : sortedKeySet)
|
||||||
{
|
{
|
||||||
Setting setting = settings.get(key);
|
Setting setting = settings.get(key);
|
||||||
String settingString = settingAsString(setting);
|
String settingString = settingAsString(setting);
|
||||||
|
|
Loading…
Reference in New Issue