#534 Get default messages from the JAR's messages_en.yml

- Using new File(class.getResource(path)) apparently is the wrong approach for in-JAR files
This commit is contained in:
ljacqu
2016-02-20 12:12:24 +01:00
parent 8511a257ed
commit 511f961d29
5 changed files with 19 additions and 21 deletions
@@ -18,7 +18,6 @@ import org.yaml.snakeyaml.Yaml;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
@@ -110,18 +109,12 @@ public class NewSetting {
}
/**
* Return the default messages file within the JAR that should contain all messages.
* Return the path to the default messages file within the JAR.
*
* @return The default messages file, or {@code null} if it could not be retrieved
* @return The default messages file path
*/
public File getDefaultMessagesFile() {
String defaultFilePath = "/messages/messages_en.yml";
URL url = NewSetting.class.getResource(defaultFilePath);
if (url == null) {
return null;
}
File file = new File(url.getFile());
return file.exists() ? file : null;
public String getDefaultMessagesFile() {
return "/messages/messages_en.yml";
}
public String getEmailMessage() {