Backups in Minecraft module are extracted into wrong directory

  • Last Post 25 May 2018
fenriv posted this 23 May 2018

OS Name/Version: Debian 9.4

Product Name/Version: AMP Beta 'TN/SR5' Minecraft module ForgeMod server installed from AMP configuration for Minecraft ( mc 1.12.2)

Problem Description: Backup are restored to a subdirectory of minecraft server directory. Instance dir: ~/.ampdata/instances// Minecraft dir: ~/.ampdata/instances//Minecraft Backup restore dir: ~/.ampdata/instances//Minecraft/MinecraftModule As result, restoring of a backup is having no effect on the instance.

Steps to reproduce: 1. Create new backup 2. Go to backups and press "Restore Backup"

Expected result: MC server state is restored to the point of a time when the backup was taken (and current state is moved to ./trash subdir).

Actual result: MC server state remaining as it was before restoring the backup.

Actions taken to resolve so far: SSH to server and move files from MinecraftModule dir to one directory higher in hierarchy.

Order By: Standard | Newest | Votes
fenriv posted this 25 May 2018

Had a little of time to look at the root of the issue and here's what I have found.

Inside LocalFileBackupPlugin in class BackupProvider there are two methods TakeBackup and RestoreBackup.
TakeBackup method is appending the ModuleName property value to the directory path in archive variable:

var directoryPathInArchive = ... ? manifest.ModuleName : Path.Combine(manifest.ModuleName, fileInfo.Directory.FullName.Substring(directoryInfo.FullName.Length));

while RestoreBackup is just running extraction:
zip.ExtractAllAsync(this.SourcePath, ExtractExistingFileAction.OverwriteSilently, task);

where SourcePath is
this.SourcePath = this.settings.Storage.OverrideOriginDirectory ? this.settings.Storage.OriginDirectory : app.BaseDirectory

The code is generated, but should be close to what actually going on within the assembly. I hope this helps with an investigation.

Mike posted this 25 May 2018

Thanks I will look into it.