-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple dataLooksValid() Calls #2178
Comments
This is the expected behavior, but not knowing what kind of archives you want to fix it's impossible to tell you how to work around it. |
I don't really need any help working around it. The purpose of this issue was to report the behavior that seemed error prone and unexpected to game plugin developers. You can see examples of people trying to work around this behavior like in the Cyberpunk plugin game_cyberpunk2077.py
Consequently this was removed yesterday to use the "built-in" mod checker, but it was one of the examples I had previously noticed. The above Cyberpunk mod will result in 4 The basic_mod_data_checker.py also makes recursive calls to It's not the recursive calls to walk back "up" the file tree that's necessarily the problem, it's the recursive calls happening repeatedly for every directory until mod organizer gives up. This isn't an issue with only the custom You could use the Imagine a mod archive.zip:
Using the
The above archive will not be fixed simply because of the I think what is happening in reality is everyone gives up trying to fix all archives and resigns to having the mod author or installer fix it. Probably not a huge issue with for games with a lot of active mod development, but for older games that means it's on the user to fix them. I guess what I'm trying to understand is what the use case is for calling |
The main idea of mod-data checker and fix is to fix standard stuff, not to try to re-organize whole archive. People have tried to do so with basic mod data checker, etc., etc., but in the end, it's impossible to have something that can fix any archives because mod authors can make any kind of weird structure in archives.
This is exactly to fix many of the badly structure mod archives created for "older" games (e.g., Morrowind / Oblivion). Many mod authors have a tendency to create archive like this:
...thus the only way to find the underlying ESP file is to recurse into sub-folders until one sub-folder is found to be valid, and the only way to know if a folder is valid is to call |
Thanks for the explanation. I realize my comment was quite long, but the point I was trying to make was I don't understand how the current behavior of Mod Organizers recursing through some directories solves anything though, including your example. I understand fully why recursing through directories is necessary for a plugin to do. I created an archive based on your example and used my simple ModDataChecker that doesn't do anything but log.
This is the output from my very simple
So Mod Organizer isn't making a calls far enough to make it to the 'Mod Name/Data' folder, so why bother with it? Just call |
Yes actually the installer will only recurse if there is a single folder (not picture or text), the picture or text stuff is to check for a You can check all the logic here: https://github.com/ModOrganizer2/modorganizer-installer_quick/blob/master/src/installerquick.cpp#L66-L112 |
The problem:
The
dataLooksValid()
method of a registeredModDataChecker
class is called repeatedly for a mod archive for every directory until it comes across a directory with more than one entry (either multiple sub-directories, files or a combination of the two). At this point, it logs aArchive is not a simple archive
message and makes 2 additionaldataLooksValid() calls
for the root""
and first directory of the archive""root_dir
. If every directory in the mod archive only contains one child directory or file , then the dataLooksValid() function is called once per until the end of the tree.I'm not sure if this is the intended behavior. If it is, I'm struggling to understand how to effectively determine if an archive is
ModDataChecker.FIXABLE
without traversing the IFileTree myself on every call to thedataLooksValid()
function of my customModDataChecker
, which is pretty ineffecient. Especially if a mod archive has a long path of single children directories resulting in multipledataLooksValid()
calls for each sub-directory.To Reproduce:
Steps to reproduce the behavior:
ModDataChecker(GameFeature)
from mobase-stubs withdataLooksValid
andfix
functions.ModDataChecker.dataLooksValid()
function, capture the path and name of thefiletree: IFileTree
parameter.qDebug(f"dataLooksValid: path=\"{filetree.path()}\", name=\"{filetree.name()}\"")
ModDataChecker
feature.Environment:
Details:
Finding difficulty trying to adapt to this behavior when writing a new plugin for a game, as you can't rely on the
dataLooksValid()
method to be called for every folder in the archive, as the calls stop whenever a directory with multiple children is found. So, I ended up checking all directories and files on all calls which is really inefficient and a huge drag on large archives. To somewhat combat this, I added an additional directory to the filetree which triggers theArchive is not a simple archive
log entry and 4 more calls todataLooksValid()
.What I think would make more sense is if
dataLooksValid()
is either only called once and left up to the customModDataChecker
to traverse the tree and figure out if a mod is valid, ordataLooksValid()
is called for every directory regardless of it's child count. Either that or allow for this functionally to be toggled or somehow signaled todataLooksValid()
so the function can determine if this is the last time it's going to be asked if the mod was valid or not.The text was updated successfully, but these errors were encountered: