nicoboss / nsz

NSZ - Homebrew compatible NSP/XCI compressor/decompressor
Other
1.41k stars 91 forks source link

Repacking a folder containing an extracted NSP using --create results in a "Is a directory" error #140

Open DarkCTO opened 1 year ago

DarkCTO commented 1 year ago

I have a game I extracted with -x But if I compress -c the same folder it gives me "Is a directory" error.

And I end up with 97Kb nsp file. Could you fix this?

DarkCTO commented 1 year ago

I just need to do nsz -c "a folder that contains subfolder"

and folder structure is preserved.

nicoboss commented 1 year ago

I have a game I extracted with -x But if I compress -c the same folder it gives me "Is a directory" error.

And I end up with 97Kb nsp file. Could you fix this?

I think you are misunderstanding the command line options. --extract just extracts the content of an NSP while --create converts a folder containing an extracted NSP back to an NSP. This has nothing to do with compression at all and are options nobody beside a few game modders are using. Regardless of why you originally encountered this issue I will test and make sure --extract and --create are working but it's highly unlikely that you or any other normal user will ever need them.

To compress an NSP to an NSZ use nsz -C YourGame.nsp - note the capital C instead of the lower-case c. No need to extract your game before compressing it. Extracting, decrypting, compressing and repacking is all done completely automatically during compression and the reverse is performed during decompression. It even does so that the file before compression and the one obtained after decompression are bit identical for the sage of game preservation.

DarkCTO commented 1 year ago

Yeah my bad, I didn't mean compression with -c Just that --create and --extract could be opposite of each other (reversible) and --create could be supporting directories with subfolders.

nicoboss commented 1 year ago

--extract and --create should be the opposite of each other but those options are barely tested as almost nobody is using them. I will investigate and make sure they work as intended.

I did some research and NSP files do not support subdirectories as far I'm aware. All files are stored under the root level. How do you expect a folder containing sub-directories to be added to an NSP? Do you want me to recursively add all the files in all the sub folders to the root of the NSP? There might be a way to store folders in an XCI but --create currently only supports NSP files.

Maybe explain why you need --extract and --create because I can think of almost no use-case where those options are useful beside game modding.