Skip to content

Commit

Permalink
Use the utility
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Oct 28, 2024
1 parent 76db3bb commit 92b0842
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,6 @@ public static void zipFolder(@NotNull File sourceFolder, File zipFile) throws IO
}
}

public static boolean isDirectoryRecursivelyEmpty(@NotNull File directory) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("The specified path is not a directory");
}

File[] files = directory.listFiles();

if (files == null || files.length == 0) {
return true;
}

for (File file : files) {
if (file.isFile()) {
return false;
} else if (file.isDirectory()) {
if (!isDirectoryRecursivelyEmpty(file)) {
return false;
}
}
}

return true;
}

public static @Nullable String getSha1HexString(File file) {
String algorithm = "SHA-1";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.esoteric.minecraft.plugins.template.resourcepack;

import foundation.esoteric.utility.file.FileUtility;
import org.apache.commons.io.FileUtils;
import org.esoteric.minecraft.plugins.template.PaperTemplatePlugin;
import org.esoteric.minecraft.plugins.template.file.FileUtil;
Expand Down Expand Up @@ -66,7 +67,7 @@ private void saveResourcepackZipFile() {
}

File assetsFile = new File(plugin.getDataPath() + File.separator + resourcePackResourceFolderName + File.separator + resourcePackAssetsFolderName);
if (FileUtil.isDirectoryRecursivelyEmpty(assetsFile)) {
if (FileUtility.Companion.isRecursivelyEmpty(assetsFile)) {
return;
}

Expand Down

0 comments on commit 92b0842

Please sign in to comment.