Open SnappyComebacks opened 9 months ago
Based on your comments, I may have misread the PR. I'll take another look tomorrow.
According to Starfire's bug-report, I guess the livery that's causing the issue is doing something like this:
countries = "USA"
To be honest, I don't remember how DCS will interpret this but it can go two ways: 1) DCS will cope with this just fine and the livery becomes available to the specified country 2) DCS ignores the value and interprets it as valid for all countries
This is obviously assuming that nothing changed in DCS since I wrote the original code.
Also, may I suggest ditching the idea to deserialize the entire livery's description file? The regex approach worked fine, and if the second case is DCS' actual behavior, then that code should work out-of-the-box. Granted, the rest of the refactor was indeed necessary and well executed, but switching up the approach to extract the required data seems to be the root cause of the problem.
Just verified, the second case applies. I can almost with certainty say that the error is indeed caused by assigning a string to countries
in the description.lua file, and having had a better look at the PR I'm pretty sure this will not only provide you with extra logging, but actually solve the issue because countries
is indeed supposed to stay None
if "bogus stuff" is assigned to countries
because DCS will indeed interpret it as valid for all countries.
Some other examples of non-standard "countries" lines in liveries, courtesy of JabbyJabara.
Several users of DCS_Liberation had exceptions raised at the call
countries_table.values()
. (See https://github.com/dcs-liberation/dcs_liberation/issues/3231 for context). It is my understanding that this is caused by an installed custom livery that has not been configured by the livery developer correctly.I have added a try/except statements to try to more gracefully handle the error that users have been encountering. In addition, I wrapped the
from_file
code with a try/except to skip a failing livery, log the error, and move on.I do not have any custom liveries downloaded, and users have not provided the failing liveries, so I was unable to test the failure.