Reading a file in the vmod archive

One of my custom classes need to read some data from a file I have placed in the vmod file.

I have never tried reading a file from a zip-file before, but I guess it involves using ZipFile and ZipEntry classes. However to to this, i need to know where to find the vmod, when the game is running. Apparently it is not in the working directory.

How do I do this?


Found the answer after some digging…



DataArchive.getName() will only get you the name of the archive. If you want to read files from the archive, you should use DataArchive.getInputStream() .

See here: … chive.html

If you try reading from the ZIP file backing the DataArchive any other way than via the DataArchive API, you risk having all sorts of threading problems.

Arrg. Thought I had it going as it seems to work fine. Well, I better change the code then.

Thx for the correction.