Skip to content

Conversation

@gulafaran
Copy link

only test the query for contain once, trim leading/traling whitespaces in extract and match exact keys to not skip valid entries where eg "Name = firefox " would appear in .desktop file.

test the query only once instead of twice.
find returns npos, use it for comparision instead of !ends
ensure valid whitespaces doesnt end up causing it as a missed entry, and
match exact keys.

begins = DATA.find('=', begins);
// trim leading whitespace
val.erase(val.begin(), std::ranges::find_if(val, [](auto c) { return !std::isspace(c); }));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyprutils::string has trim


if (begins == std::string::npos)
begins = DATA.find("\n" + std::string{what} + "=");
if (line.size() <= key.size() || line[key.size()] != '=')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if Key = name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants