those didnt work
This commit is contained in:
parent
febbb95b97
commit
7734c16e06
@ -102,14 +102,13 @@ public class MakeBackupRunnable implements Callable<Void> {
|
|||||||
case TAR -> new AbstractTarArchiver().createArchive(world, outFile, context, coreCount);
|
case TAR -> new AbstractTarArchiver().createArchive(world, outFile, context, coreCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Globals.INSTANCE.getQueueExecutor().isShutdown())
|
||||||
Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server())));
|
Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server())));
|
||||||
|
|
||||||
if (config.get().broadcastBackupDone) {
|
if (config.get().broadcastBackupDone) Utilities.notifyPlayers(context.server(), "Done!");
|
||||||
Utilities.notifyPlayers(context.server(), "Done!");
|
else log.sendInfoAL(context, "Done!");
|
||||||
} else {
|
|
||||||
log.sendInfoAL(context, "Done!");
|
} catch (Throwable e) {
|
||||||
}
|
|
||||||
} catch (InterruptedException | ExecutionException | IOException e) {
|
|
||||||
//ExecutorService swallows exception, so I need to catch everything
|
//ExecutorService swallows exception, so I need to catch everything
|
||||||
log.error("An exception occurred when trying to create new backup file!", e);
|
log.error("An exception occurred when trying to create new backup file!", e);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package net.szum123321.textile_backup.core.digest;
|
package net.szum123321.textile_backup.core.digest;
|
||||||
|
|
||||||
import net.szum123321.textile_backup.Globals;
|
import net.szum123321.textile_backup.Globals;
|
||||||
|
import net.szum123321.textile_backup.core.CompressionStatus;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -29,11 +30,13 @@ public class FileTreeHashBuilder {
|
|||||||
private long hash = 0, filesProcessed = 0, filesTotalSize = 0;
|
private long hash = 0, filesProcessed = 0, filesTotalSize = 0;
|
||||||
|
|
||||||
public void update(Path path, long newHash) throws IOException {
|
public void update(Path path, long newHash) throws IOException {
|
||||||
|
if(path.getFileName().toString().equals(CompressionStatus.DATA_FILENAME)) return;
|
||||||
|
|
||||||
var hasher = Globals.CHECKSUM_SUPPLIER.get();
|
var hasher = Globals.CHECKSUM_SUPPLIER.get();
|
||||||
|
|
||||||
long size = Files.size(path);
|
long size = Files.size(path);
|
||||||
|
|
||||||
hasher.update(path.toString().getBytes(StandardCharsets.UTF_8));
|
hasher.update(path.getFileName().toString().getBytes(StandardCharsets.UTF_8));
|
||||||
hasher.update(newHash);
|
hasher.update(newHash);
|
||||||
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
package net.szum123321.textile_backup.core.digest;
|
package net.szum123321.textile_backup.core.digest;
|
||||||
|
|
||||||
import net.szum123321.textile_backup.Globals;
|
import net.szum123321.textile_backup.Globals;
|
||||||
import net.szum123321.textile_backup.core.FileTreeHashBuilder;
|
|
||||||
import net.szum123321.textile_backup.core.Hash;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.FilterOutputStream;
|
import java.io.FilterOutputStream;
|
||||||
@ -41,14 +39,14 @@ public class HashingOutputStream extends FilterOutputStream {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
super.write(b);
|
|
||||||
hasher.update(b);
|
hasher.update(b);
|
||||||
|
super.write(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte @NotNull [] b, int off, int len) throws IOException {
|
public void write(byte @NotNull [] b, int off, int len) throws IOException {
|
||||||
super.write(b, off, len);
|
|
||||||
hasher.update(b, off, len);
|
hasher.update(b, off, len);
|
||||||
|
super.write(b, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user