Skip to content

Commit

Permalink
work on #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiboo committed Mar 1, 2019
1 parent f15613d commit 507133e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/io/github/cadiboo/nocubes/util/BadAutoUpdater.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package io.github.cadiboo.nocubes.util;

import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import org.apache.maven.artifact.versioning.ArtifactVersion;

import java.io.BufferedInputStream;
import java.io.File;
import java.lang.reflect.Field;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;

import static io.github.cadiboo.nocubes.util.ModReference.MOD_ID;

/**
* A bad auto-updater until I implement delta-patching
*
Expand Down Expand Up @@ -44,11 +50,14 @@ public static void update(final ArtifactVersion currentVersion, final String new
return;
}

//delete the current jar
final String oldJarFileName = modFileName + "-" + currentVersion + ".jar";
final Path pathToOldJar = new File(modsDir, oldJarFileName).toPath();
// //delete the current jar
// final String oldJarFileName = modFileName + "-" + currentVersion + ".jar";
// final Path pathToOldJar = new File(modsDir, oldJarFileName).toPath();

//TODO:
final Path modSourceFile = ((ModFileInfo) ModList.get().getModContainerById(MOD_ID).get().getModInfo().getOwningFile()).getFile().getFilePath();

Files.delete(pathToOldJar);
Files.delete(modSourceFile);

}

Expand Down

0 comments on commit 507133e

Please sign in to comment.