Added 'remove library files'
This commit is contained in:
@@ -28,6 +28,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.AssetIndexDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.code.DigestUtils;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
@@ -127,11 +128,12 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
File objectDir = new File(assetsDir, "objects");
|
||||
File indexFile = new File(indexDir, assetIndex.getId() + ".json");
|
||||
|
||||
if (!assetsDir.exists() && !indexFile.isFile())
|
||||
if (!assetsDir.exists() || !indexFile.isFile())
|
||||
return false;
|
||||
|
||||
try {
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(FileUtils.readFileToString(indexFile, "UTF-8"), AssetsIndex.class);
|
||||
String assetIndexContent = FileUtils.readFileToString(indexFile, "UTF-8");
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(assetIndexContent, AssetsIndex.class);
|
||||
|
||||
if (index == null)
|
||||
return false;
|
||||
@@ -158,7 +160,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
}
|
||||
|
||||
try {
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(FileUtils.readFileToString(indexFile, "UTF-8"), AssetsIndex.class);
|
||||
String assetIndexContent = FileUtils.readFileToString(indexFile, "UTF-8");
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(assetIndexContent, AssetsIndex.class);
|
||||
|
||||
if (index == null)
|
||||
return assetsDir;
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.jackhuang.hellominecraft.util.OverridableSwingWorker;
|
||||
import org.jackhuang.hellominecraft.util.version.MinecraftVersionRequest;
|
||||
import org.jackhuang.hellominecraft.util.system.OS;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.ui.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.Java;
|
||||
@@ -171,6 +172,12 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
getProfile().service().asset().refreshAssetsIndex(mcVersion);
|
||||
});
|
||||
ppmManage.add(itm);
|
||||
itm = new JMenuItem(C.i18n("versions.mamage.remove_libraries"));
|
||||
itm.addActionListener((e) -> {
|
||||
if (mcVersion != null)
|
||||
FileUtils.deleteDirectoryQuietly(new File(getProfile().service().baseDirectory(), "libraries"));
|
||||
});
|
||||
ppmManage.add(itm);
|
||||
}
|
||||
|
||||
void initExternalModsTable() {
|
||||
|
||||
Reference in New Issue
Block a user