fix create config file error...

This commit is contained in:
502647092 2015-09-01 08:14:15 +08:00
parent dba9a1df20
commit 7ea5c5e71a

View File

@ -29,7 +29,8 @@ import com.google.common.base.Charsets;
import com.google.common.io.Files; import com.google.common.io.Files;
/** /**
* An implementation of {@link Configuration} which saves all files in Yaml. Note that this * An implementation of {@link Configuration} which saves all files in Yaml.
* Note that this
* implementation is not synchronized. * implementation is not synchronized.
*/ */
public class FileConfig extends YamlConfiguration { public class FileConfig extends YamlConfiguration {
@ -74,9 +75,10 @@ public class FileConfig extends YamlConfiguration {
InputStream stream = plugin.getResource(filename); InputStream stream = plugin.getResource(filename);
try { try {
if (!file.exists()) { if (!file.exists()) {
file.mkdirs();
if (stream == null) { if (stream == null) {
file.createNewFile(); file.createNewFile();
loger.info("配置文件 " + filename + " 创建失败..."); loger.info("配置文件 " + filename + " 不存在 创建新文件...");
} else { } else {
plugin.saveResource(filename, true); plugin.saveResource(filename, true);
loger.info("配置文件 " + filename + " 不存在 从插件释放..."); loger.info("配置文件 " + filename + " 不存在 从插件释放...");