Skip to content

Commit

Permalink
Roll back adaptions for ConfigMe 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ljacqu committed Apr 28, 2024
1 parent e06445b commit 8dec88d
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ch.jalu.configme.resource.PropertyReader;
import ch.jalu.configme.resource.YamlFileResource;
import org.jetbrains.annotations.NotNull;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;

Expand All @@ -20,12 +19,12 @@ public MigraterYamlFileResource(File file) {
}

@Override
public @NotNull PropertyReader createReader() {
public PropertyReader createReader() {
return MessageMigraterPropertyReader.loadFromFile(getFile());
}

@Override
protected @NotNull Yaml createNewYaml() {
protected Yaml createNewYaml() {
if (singleQuoteYaml == null) {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Expand All @@ -37,4 +36,12 @@ public MigraterYamlFileResource(File file) {
}
return singleQuoteYaml;
}

// Because we set the YAML object to put strings in single quotes, this method by default uses that YAML object
// and also puts all paths as single quotes. Override to just always return the same string since we know those
// are only message names (so never any conflicting strings like "true" or "0").
@Override
protected String escapePathElementIfNeeded(String path) {
return path;
}
}

0 comments on commit 8dec88d

Please sign in to comment.