D20092: New class KOSRelease - a parser for os-release files

Pino Toscano noreply at phabricator.kde.org
Sat Mar 30 17:16:41 GMT 2019


pino added inline comments.

INLINE COMMENTS

> kosrelease.cpp:120-126
> +            if (parts.size() != 2 || line.contains(QLatin1Char('#'))) {
> +                // Invalid line...
> +                // For the purposes of simple parsing we'll not support >2 =
> +                // or >1 # characters.
> +                // The former makes splitting and the latter makes comment
> +                // stripping difficult.
> +                continue;

This fails if any field as '=' in it; considering that few fields contain display text, they may contain it as part of the "pretty name" of the distribution. Sure, not highly probably, but still possible.
I recommend to manually find the first '=', and split key/value accordingly.

> kosrelease.h:104
> +
> +    static QString defaultFilePath();
> +

If it is not needed as public, just make it static in the .cpp file.

REPOSITORY
  R244 KCoreAddons

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D20092

To: sitter, apol, mpyne
Cc: pino, aacid, mpyne, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190330/ab21a2d6/attachment.html>


More information about the Kde-frameworks-devel mailing list