-
Notifications
You must be signed in to change notification settings - Fork 167
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
Ignore conflicts between hidden files #2148
base: master
Are you sure you want to change the base?
Ignore conflicts between hidden files #2148
Conversation
src/filetreemodel.cpp
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.