return file1.toString().length() - file2.toString().length();
}
});
for (File settingsFile : settingsFiles) {
// Find first parent with settings, or use defaults.
Settings settings = null;
File parent = settingsFile.getParentFile();
while (true) {
if (parent.equals(root)) break;
parent = parent.getParentFile();
settings = dirToSettings.get(parent);
if (settings != null) {
settings = new Settings(settings);
break;
}
}
if (settings == null) settings = new Settings(defaultSettings);
// Merge settings from current directory.
try {
json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
} catch (SerializationException ex) {
throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);