Szum123321 / textile_backup

Backup Mod for Fabric
https://www.curseforge.com/minecraft/mc-mods/textile-backup
GNU General Public License v3.0
90 stars 31 forks source link

[bug] unable to decompress the files supplied by mods correctly #56

Closed Harveykang closed 1 year ago

Harveykang commented 3 years ago

image image there should be some files in this folder, but it's empty after restore

Szum123321 commented 3 years ago

I'll look into it

Harveykang commented 3 years ago

I'll look into it

thank you ^_^

Szum123321 commented 3 years ago

May I ask what mod adds those scripts?

Harveykang commented 3 years ago

https://github.com/gnembon/fabric-carpet this one

Harveykang commented 3 years ago

this mod supplies a script language, similar to datapack in vanilla

Harveykang commented 3 years ago

check this... https://github.com/FZ-Studio/textile_backup/commit/9518ef9c76e60ce0bf7cd7c6fe5458577020329d just don't delete directories idk why cannot delete the directory..

Szum123321 commented 3 years ago

It should be more like this:

        boolean state = true;

        if(f.isDirectory()) {
            for(File f2 : f.listFiles()) state &= deleteDirectory(f2);
        }

        return (f.isDirectory() ? true : f.delete()) && state;

Although I can't see how that would work...

The only reason I can think of right now i that maybe those files where somehow write protected. If so have you seen a message saying Something went wrong while deleting old world! ?

Harveykang commented 3 years ago

i saw that message. but the folder was actually deleted. then the carpet mod will create an empty “scripts” folder on server started.

Szum123321 commented 3 years ago

huh. I suppose that maybe some part of the file gets left which makes it later impossible to restore them...

https://github.com/Szum123321/textile_backup/tree/56-bugfix

Here's a branch where I made it so that files that weren't deleted get logged. Do you know how to build fabric mod?

Harveykang commented 3 years ago

yeah i know

Harveykang commented 3 years ago

image

what the hell..

Szum123321 commented 3 years ago

Well, the game fails to create scripts folder and so the scripts don't get decompressed. Can you check if the folder is write-protected or something?

Szum123321 commented 3 years ago

ok I just found a way to tell exactly what went wrong. Give me a moment, and I'll commit changes to that branch

Harveykang commented 3 years ago

ok btw, the folder has no write-protection

Szum123321 commented 3 years ago

ok. See 011283dc094e2380e350914b7532c264e745d3f5 Files.createDirectories throws and exception if something goes wrong

Harveykang commented 3 years ago

[01:55:18] [Textile Backup restore thread nr. 0/ERROR] (textile_backup) [Textile Backup] An exception occurred when trying to create .\world\scripts\here.sc java.nio.file.AccessDeniedException: E:\VSCode Projects\textile_backup-56-bugfix\run.\world\scripts                 at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:504) ~[?:1.8.0_181]                 at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_181]                 at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_181]                 at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_181]                 at net.szum123321.textile_backup.core.restore.decompressors.ZipDecompressor.decompress(ZipDecompressor.java:61) [textile_backup-2.1.0-prev-1.16-dev.jar:?]                 at net.szum123321.textile_backup.core.restore.RestoreBackupRunnable.run(RestoreBackupRunnable.java:78) [textile_backup-2.1.0-prev-1.16-dev.jar:?]                 at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181] [01:55:18] [Textile Backup restore thread nr. 0/ERROR] (textile_backup) [Textile Backup] An exception occurred while trying to decompress file: here.sc java.nio.file.AccessDeniedException: .\world\scripts\here.sc                 at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[?:1.8.0_181]                 at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230) ~[?:1.8.0_181]                 at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434) ~[?:1.8.0_181]                 at java.nio.file.Files.newOutputStream(Files.java:216) ~[?:1.8.0_181]                 at net.szum123321.textile_backup.core.restore.decompressors.ZipDecompressor.decompress(ZipDecompressor.java:66) [textile_backup-2.1.0-prev-1.16-dev.jar:?]                 at net.szum123321.textile_backup.core.restore.RestoreBackupRunnable.run(RestoreBackupRunnable.java:78) [textile_backup-2.1.0-prev-1.16-dev.jar:?]                 at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

Harveykang commented 3 years ago

it's 2 a.m. in china, i have to go to sleep. if there is any problem, i'll reply tomorrow :)