-
Notifications
You must be signed in to change notification settings - Fork 26
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
Skip .git dirs & .mohidden files #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem with this approach is that we're still attempting to maintain USVFS as a generally separate utility from MO2. So these direct MO2-specific features are a no-go.
What would need to be done here would be to implement a blacklist feature where you could pass directories or file patterns when MO2 runs USVFS and then have USVFS ignore the blacklisted directories / files.
There are also other things we've got on the MO2 tracker that we can't implement without a directory and file blacklist, like profile-specific saved games for games that don't have a convenient INI setting to change the save directory location, so that approach would have extra utility, too. |
I don't think a blacklist would be sufficient for profile-specific save games, there are two use-cases
|
That's what I was interpreting blacklist to mean - I was expecting that MO2 would pass in the paths of all |
Regardless of what MO2 gives to USVFS, that's two very different behaviors, so I don't think you can handle both of them properly from USVFS. Not sure if we're already saying the same thing but I will clarify my point. Consider the two directories: X/
.git/
foo
bar
Y/
foo
baz If you currently map
|
For context, I know very little about the specific internals of USVFS, but from knowing vague details about its operation and other stuff about VFSes in general and how MO2 exposes stuff, I'd have expected the implementation for the two behaviours to be very similar. I'm under the impression the real |
I believe, for the purposes of this change, we're merely discussing ignoring mapped directories or files coming from MO2. This could be done in MO2 but then we'd be complicating the mapping process since we're generally only concerned about the top level directories on the MO2 side. USVFS then crawls through the directories as it translates directories into mapped file locations. I think being able to remove specific file patterns or directory names from the mapping process in USVFS does have its uses, not just to avoid spending extra time on files we don't need to worry about mapping (as per the original PR here). Being able to hide files from the original directories is definitely a more complicated process as we'd need to modify most of the hooks to essentially avoid returning data about the files in those locations and only produce file handles for mapped locations. This is doable but not necessarily the same as a basic mapping blacklist. |
I'm not much familiar with USVFS, but from my understand, the first cases can simply be done by not adding the files/directories to ignore to the virtual file-tree maintained by USVFS. In the second case, you actually need to modify the way hooks work since, when a file is not mapped, USVFS falls back to the original file, so you would need to check if the file is part of a "fully redirected" directory, and if so, redirect to the mapped directory. |
The example use-case here, not just about a theoretical .git directory (which would be a silly thing to have in a mod, but I guess it could happen), removing .mohidden files from the file mapping actually makes a lot of sense. Because the way it currently works, these files are technically there and visible to the application being hooked. They're just not used because they've been renamed to something the application doesn't care about. If you have a bunch of textures with overlaps and you have to hide a handful from several mods to get the exact combination you care about, now USVFS has to consider a bunch of extra overlapping file conflicts for files that ultimately don't matter. It would be better if it just ignored them completely. So that's why I'm generally 'for' this change, if it can be implemented properly. |
I spent some time experimenting last night with a more proper implementation, and as @qudix had suggested in the discord, a similar implementation to Line 150 in ed0e04d
|
Sounds good. I think that's the best approach. I personally think having two such methods would be ideal. One for directory names and one for file pattern matching (be that a glob or regex). I see less overall need for partial matching for directories while being able to match file extensions would be ideal (but also having the ability to block specific file names if needed). |
I wanted to avoid glob or regex just from a purely performance concern, but the performance hit with regex might just be negligible. If you have any thoughts on that please air them, I'm not that experienced in MO2 to know if it'd be a big hit (unless it's implemented poorly). I was going to go for a very simple custom wildcard pattern, eg *.git, readme.txt, *.txt, *.mohidden, someEsp.mohidden. Also, would customizing the list be better to have on a "global" MO2 setting, or a plugin level setting? |
Authors
Modifications
Skips .git directories and .mohidden files to speed up USVFS loading, this can also make UI refreshes quicker