loot / libloot

A C++ library for accessing LOOT's metadata and sorting functionality.
GNU General Public License v3.0
32 stars 12 forks source link

Libloot is looking for version of LOOT.exe #66

Closed LostDragonist closed 2 years ago

LostDragonist commented 4 years ago

Tested on libloot 0.15.1.0

The SSE and FO4 masterlists added conditions like this

condition: 'version("LOOT", "0.13.1.0", <) and file("cc[A-Z]{3}SSE[0-9]{3}.*\.es(l|m)")'``

Tests are showing that the version("LOOT") condition is checking the version of LOOT.exe. This is undesirable for third-party users of libloot as LOOT.exe may not exist. It would also be undesirable to check the version of the calling executable as the version may have nothing to do with the versions of LOOT and libloot.

Ideally, this version condition would be changed to check the version of the libloot DLL as that's what is handling the parsing the plugins and masterlist. Note that the DLL should not be referenced by name as it could be called "loot.dll" in some places and "libloot.dll" in other places.

As far as I can tell, this behavior starts at https://github.com/loot/libloot/blob/master/src/api/metadata/condition_evaluator.cpp#L98 though I can't really follow the logic.

Ortham commented 4 years ago

This is essentially a leftover from before there was a separate libloot library, you're right in that it's not always appropriate any more. In this case, checking the version of libloot used might be more appropriate, but the relevant version number is different, so "LOOT" can't just be made to refer to the version of libloot.

Just checking the version of libloot may not be enough anyway, as someone may be running a new enough version of libloot but a version of LOOT that does not have the required supporting changes (in this case to support ESL files correctly).

It might be worth adding a "libloot" equivalent to "LOOT", but I think the best approach would be to add a file("LOOT") and ... to those conditions to make sure they only show up when LOOT.exe is present (though it may be present but not the calling executable, but that can't be resolved without code changes).

Ortham commented 2 years ago

Closing this as the potential non-existence of LOOT.exe is now documented as of caee647d863ed77d4a7c289c56d2d45980eea137.