Why are Preferences stored in a zip archive?

Why do we store preferences in a zip archive? I take it that this isn’t for
reasons of space efficiency, as the files are tiny even when uncompressed.

(I’m curious, because having the initial and max heap sizes written in the
prefs archive makes fishing them out more complex than it would be if this
weren’t a zip.)

*********** REPLY SEPARATOR ***********

On 29/01/2008 at 3:28 AM uckelman wrote:

Also, on my windoze system, I end up with a zillion tempnn.zip files containing old versions of prefs that don’t get deleted. Similiar to the tmp file problem with the memory map files.


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Oh, really, is that what those are from? I end up with a few of those
on my Linux system as well. I’ll check that out.

The main reason I’m wondering about having the prefs in a zip archive
is the following: Whatever launches VASSAL needs to know what the
heap size should be. What I’m doing now is writing that into the prefs,
and then using VASSAL.launch.Launcher to read the prefs and launch a
new JVM to run VASSAL.launch.Main with that heap size. This works,
but starting a second JVM is massive overkill just to read two numbers,
and it makes starting VASSAL take a bit longer. On my machine I the
initial screen appears exactly at the moment when I begin to wonder if
something has gone wrong. (In this respect, it is precisely like the
lights in the bathroom down the hall from my office.)

For UNIX, we have a ton of flexibility, because you can do anything from
a shell script. If the prefs were already plain text, it would be simple
to grep out the heap sizes and put them into the command for starting
the JVM. Or, if the heap sizes were saved in a separate file when the
prefs are changed, a cat heap put into the command line will take care
of it.

For a Mac bundle, the heap sizes are in the Info.plist file, which is
just XML and could be rewritten when the prefs are changed (…so long
as there’s no problem with rewriting the Info.plist of a running app).

For Windows… ugh. The JAR wrapper which I choose, JSmooth, is otherwise
wonderful, but doesn’t provide the ability to read configuration options
for the JVM from a file at runtume. (You can set defaults when you build
the binary, and you can override them on the command line, neither of
which helps us.) I’m now looking into another JAR wrapper, Launch4j, which
does read JVM options from a file. That would give us a (similar) solution
on all platforms.

Other things:

  1. Would it be better to have prefs stored in the root folder for each
    VASSAL version?

  2. Do you still see leftover temp files when using memory-mapped images?
    (That should be fixed now—if it’s not, I’d like to know.)


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

It’s simply because there’s a different set of preferences for each module. Zipping them into one file avoids a proliferation of small preferences files and avoid problems with non-standard characters in the file names.

It would be perfectly legit to store the heap size preferences in a separate file in the same directory, though. However, you’d have to muck around with writing special code to save/restore the setting for just that key.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Rodney Kinney”:

Thanks for the explanation.

If found a different solution to the problem, which doesn’t involve
reading the prefs.

On Windows, I switched the launcher EXE from one built with JSmooth
to one built with Launch4j. Launch4j will read JVM arguments from
a VASSAL.l4j.ini file, which is just a list of arguments and so is
simple to read and write.

On Mac OSX, the JVM arguments are read from Info.plist, which has
a simple structure and is also simple to read and write.

On any other UNIX, we can write the heap values to a file and then
cat the file into the command line in the script.

Thus, no need to read the prefs prior to starting the JVM.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)