Ignore conflicts between hidden files#2148
Conversation
| if (showConflictsOnly() && | ||
| ((file.getAlternatives().size() == 0) || | ||
| fs::path(file.getName()) | ||
| .extension() | ||
| .compare(ModInfo::s_HiddenExt.toStdWString()) == 0)) { | ||
| // only conflicts should be shown, but this file is hidden or not conflicted |
There was a problem hiding this comment.
This should be a hotpath, I don't know how fast the fs:path conversion to compare the extension is. Might be worth profiling this under a large setup. I know we got massive wins by using a faster string comparison in the past
There was a problem hiding this comment.
Do you think file.getName().ends_with(ModInfo::s_HiddenExt.toStdWString()) would suffice? That's what I used here. I only used the fs::path conversion here to be consistent with similar existing code that I used as a reference.
There was a problem hiding this comment.
The check needs to be case insensitive, which is what can make it costly. If it isn't a problem on a larger setup we don't need to optimize it. Just need to check it isn't a problem.
There was a problem hiding this comment.
The extension being anything other than fully lowercase would be an unusual edge case, but I suppose we should still account for that possibility. I'm not sure how to go about profiling it though. If we already know it's a hot path, I'd say it's worth optimizing regardless. How about boost::algorithm::iends_with(file.getName(), ModInfo::s_HiddenExt.toStdWString()))? It's case insensitive and doesn't require a fs::path conversion.
There was a problem hiding this comment.
QString::fromStdWString(file.getName()).endsWith(ModInfo::s_HiddenExt, Qt::CaseInsensitive))Not sure why FileEntry uses std::w/string types. Also the less boost usage, the better.
|
Any other considerations/blockers or can this be merged as is? I thought about having |
|
Since I addressed the comments from you and AL, it can be merged as far as I'm concerned, unless another developer still wants to look at it. Changing |
Conflicts between hidden files are now no longer considered conflicts and will no longer show up in the mod conflict flags, the (advanced) conflicts tab, or the data tab if "Show conflicts only" is checked. The "Unhide" context menu action is also removed from the conflicts tab, since it's no longer used if hidden files no longer show up there.
Regarding the data tab filters, I considered force-unchecking and disabling the "Show hidden files" checkbox as soon as "Show conflicts only" filter is checked as an alternative implementation, but I think that will only lead to more complex code and worse UX since the user would have to re-check it again afterwards.
This was listed as a suggestion in #464.