Crash if file was not deleted

This commit is contained in:
Timo Ley 2021-06-01 16:01:19 +02:00
parent b75a0cfbdf
commit cab557e439
2 changed files with 7 additions and 3 deletions

View file

@ -44,8 +44,11 @@ public class FileHandler {
public void removeFiles(List<RelationFile> rels) { public void removeFiles(List<RelationFile> rels) {
for (RelationFile rel : rels) { for (RelationFile rel : rels) {
File f = getFile(rel.dir, rel.filename()); File f = getFile(rel.dir, rel.filename());
if (f.exists()) if (f.exists()) {
f.delete(); if (!f.delete()) {
throw new RuntimeException("Updater is not able to delete File. Please delete it manually: " + f.getAbsolutePath());
}
}
} }
} }

View file

@ -9,6 +9,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException;
import java.util.List; import java.util.List;
public class UpdateTweaker implements ITweaker { public class UpdateTweaker implements ITweaker {
@ -54,7 +55,7 @@ public class UpdateTweaker implements ITweaker {
config.toJson(writer); config.toJson(writer);
writer.close(); writer.close();
} }
} catch (Exception e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }