Create account / Log in

Extensions loading order

Issues with the Vassal engine.

Moderators: uckelman, Tim M

Extensions loading order

Postby g1ul10 » December 16th, 2020, 2:34 pm

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! :-) All the best, Giulio.

PS: recent VASSAL developments are great guys! keep up with the good work.
g1ul10
 
Posts: 17
Joined: March 20th, 2014, 9:41 pm

Re: Extensions loading order

Postby g1ul10 » December 17th, 2020, 12:36 pm

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.
g1ul10
 
Posts: 17
Joined: March 20th, 2014, 9:41 pm

Re: Extensions loading order

Postby uckelman » December 17th, 2020, 6:59 pm

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.
User avatar
uckelman
Site Admin
 
Posts: 9227
Joined: December 10th, 2007, 9:48 am
Location: Durham, England


Return to Technical Support & Bugs

Who is online

Users browsing this forum: No registered users and 3 guests