Skip to content

Commit

Permalink
feat(utils): FileUtils extends apache io FileUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Mar 31, 2022
1 parent a5052ef commit 45dbf1d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/org/auioc/mods/arnicalib/utils/java/FileUtils.java
Expand Up @@ -8,11 +8,11 @@
import org.apache.logging.log4j.Marker;
import org.auioc.mods.arnicalib.utils.LogUtil;

public interface FileUtils {
public class FileUtils extends org.apache.commons.io.FileUtils {

static Marker MARKER = LogUtil.getMarker(FileUtils.class);
private static final Marker MARKER = LogUtil.getMarker(FileUtils.class);

static File getOrCreateDirectory(String directoryName) throws IOException {
public static File getOrCreateDirectory(String directoryName) throws IOException {
var file = new File(directoryName);

if (file.exists()) {
Expand All @@ -26,7 +26,7 @@ static File getOrCreateDirectory(String directoryName) throws IOException {
throw new IOException("Could not create directory \"" + file + "\"");
}

static File getFile(String fileName) throws IOException {
public static File getFile(String fileName) throws IOException {
var file = new File(fileName);

if (file.getParentFile().exists()) {
Expand All @@ -40,7 +40,14 @@ static File getFile(String fileName) throws IOException {
throw new IOException("Could not create parent directory of file \"" + file + "\"");
}

static void writeText(String fileName, String text) throws IOException {
/* ============================================================================================================== */
// #region Deprecated

@Deprecated
private FileUtils() {}

@Deprecated(since = "5.1.4")
public static void writeText(String fileName, String text) throws IOException {
var file = getFile(fileName);

if (file.exists()) {
Expand All @@ -52,4 +59,6 @@ static void writeText(String fileName, String text) throws IOException {
writer.close();
}

// #endregion Deprecated

}

0 comments on commit 45dbf1d

Please sign in to comment.