mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2024-09-19 20:25:51 +00:00
fix(file): 修复 FileConfigProvider#saveResource 文件创建异常的问题。#39
This commit is contained in:
parent
81e024e309
commit
07424284b7
@ -5,7 +5,10 @@ import cc.carm.lib.configuration.core.source.ConfigurationWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
@ -36,12 +39,15 @@ public abstract class FileConfigProvider<W extends ConfigurationWrapper<?>> exte
|
||||
}
|
||||
|
||||
if (sourcePath != null) {
|
||||
try {
|
||||
saveResource(sourcePath, true);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveResource(@NotNull String resourcePath, boolean replace)
|
||||
throws NullPointerException, IOException, IllegalArgumentException {
|
||||
throws IOException, IllegalArgumentException {
|
||||
Objects.requireNonNull(resourcePath, "ResourcePath cannot be null");
|
||||
if (resourcePath.equals("")) throw new IllegalArgumentException("ResourcePath cannot be empty");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user