dsda-doom icon indicating copy to clipboard operation
dsda-doom copied to clipboard

feature request: zip support

Open liPillON opened this issue 2 years ago • 2 comments

I check the patch notes from time to time and 0.25 is shaping up to be a pretty major release... Would you consider adding zip archive support, too?

I think it would be a pretty handy feature: Woof has it and being able to load the archive downloaded from dsda/idgames directly has pampered me a little bit lately..

Thank you for all the work on this port!

liPillON avatar Sep 13 '22 07:09 liPillON

It's something I plan on doing but I'm not sure when - most likely not in 0.25

kraflab avatar Sep 13 '22 15:09 kraflab

Nice! I'll wait then, there's already enough stuff on the table..

liPillON avatar Sep 13 '22 21:09 liPillON

I've just had the chance to try this, thank you all!

Is there any plan to add zip support to the autoload routines, too? Sorry, I should have specified it earlier..

liPillON avatar Apr 07 '23 10:04 liPillON

Yes I will be expanding zip support to cover various other cases

kraflab avatar Apr 07 '23 13:04 kraflab

Great!

One last thing: I've noticed that the current implementation does not remove from %TEMP% (I'm on Windows 11) the directories created for each zip. This could become a problem, should a zip archive be modified by removing/renaming/updating its contents: the temporary folder would then end up having both old and new versions of each wad/lump - leading to unpredictable/unexpected behaviour.

Keep up the good work!

liPillON avatar Apr 07 '23 13:04 liPillON

@FtZPetruska maybe the unzipping code should remove the directory if it exists before unzipping, what do you think?

kraflab avatar Apr 07 '23 13:04 kraflab

Thanks for the heads up, I think I have a patch ready to address that.

Finding a way to recursively delete directories was surprisingly tedious (M_remove only works on empty directories, I_Glob API does not list directories, the easiest WIN32 call to achieve that requires double-null terminated string). I'm going to run a few more tests before opening a PR.

FtZPetruska avatar Apr 07 '23 20:04 FtZPetruska

@FtZPetruska should we use the md5 checksum of a zip file instead of its name for the temp directory? I'm just realizing for instance -file my_zip.zip my_other_zip/my_zip.zip is going to have problems 😄

Does it take long to compute a checksum of a large file? I have no clue tbh. It will make the logs less decipherable - maybe for instance my_zip.zip-<checksum> could be the location.

kraflab avatar Apr 20 '23 14:04 kraflab

There are other ways to avoid overwrites, like we could just have a zip file counter and append it to the name, so you get first.zip-1 second.zip-2 etc.

kraflab avatar Apr 20 '23 14:04 kraflab

github notifications brought me here, so while I'm here I'll comment on this:

the unzipping code should remove the directory if it exists before unzipping

I think removing the temporary folders during program shutdown would be better (Woof does this, iirc)

Having tried one of the latest dsda builds with various wads over the course of a week, I've noticed that a lot of cruft has accumulated in my %TEMP% folder..

liPillON avatar Apr 20 '23 15:04 liPillON

There are other ways to avoid overwrites, like we could just have a zip file counter and append it to the name, so you get first.zip-1 second.zip-2 etc.

Done so here: https://github.com/fabiangreffrath/woof/commit/5156ef30e9eb1a49c9d7daaea82745383d669348

fabiangreffrath avatar Apr 20 '23 15:04 fabiangreffrath

@liPillON as of https://github.com/kraflab/dsda-doom/commit/9c93ea86ddf49c6862d958ad7e2ed65c20f27fe4 it should be possible to autoload zip files and another change since the initial implementation is things like -file something will load something.zip if it exists (and there is no something.wad). Let me know if you run into any issues or if you think something is still missing.

kraflab avatar Apr 21 '23 11:04 kraflab

Thank you both for refining this! I'll see what I can do to provide my feedback, probably after the weekend.

liPillON avatar Apr 21 '23 14:04 liPillON

hey, just chiming in to say sorry for failing to provide a final feedback I've messed up my build environment, so I'm unable to test on my win11 machine.. that's all :(

liPillON avatar May 05 '23 14:05 liPillON