Extensions loading order

Hi.
I’m working on updating a rather large project, the module of Band of Brothers. The game has several extensions. I’m not able to understand in which order the extensions are loaded by the module. Any advice on how to control it? Inspecting the forum, I found that this question has been raised a couple of times in the last ten years or so, but no answer was given. I hope to be luckier! :slight_smile: All the best, Giulio.

PS: recent VASSAL developments are great guys! keep up with the good work.

since nobody speaks I can try to partially answer my own question. I never studied the VASSAL source so maybe I’m wrong but the list of potential extensions seems to be created by the following line (line 162 in ExtensionsManager.java release 3.4.11)

File[] files = dir.listFiles(filter);

now I found comments on the net that says listFile is not guaranteed to report files in any specific order (is it true? no idea but if this is responsible for what I observe it is very likely). So my suggestion is to order the array “extensions” before returning it (line 175 same file). In this way, we have a predictable way in which extensions are loaded. My Java’s rusty but it is likely to be a one liner. Can the saviors here tell me if I’m correct and if they can take care of this? Thanks in advance.

Thus spake g1ul10:

since nobody speaks I can try to partially answer my own question. I
never studied the VASSAL source so maybe I’m wrong but the list of
potential extensions seems to be created by the following line (line 162
in ExtensionsManager.java release 3.4.11)

File[] files = dir.listFiles(filter);

now I found comments on the net that says listFile is not guaranteed to
report files in any specific order (is it true? no idea but if this is
responsible for what I observe it is very likely). So my suggestion is
to order the array “extensions” before returning it (line 175 same
file). In this way, we have a predictable way in which extensions are
loaded. My Java’s rusty but it is likely to be a one liner. Can the
saviors here tell me if I’m correct and if they can take care of this?
Thanks in advance.

I’ve opened an issue (13827) and a PR (622) for this. My guess is that
whoever wrote this didn’t realize there was no order guarantee provided
by File.listFiles().

Expect a fix in 3.4.12.


J.