a problem with kdesktopfile.cpp

Nicolás Alvarez nicolas.alvarez at gmail.com
Wed Feb 4 23:18:33 UTC 2015


2015-02-04 15:54 GMT-03:00 Guy Maurel <guy.maurel at kde.org>:
> Hello!
>
> I wonder about the code of kdesktopfile.cpp at line 80:
> ...
> QString KDesktopFile::locateLocal(const QString &path)
> {
>     QString relativePath;
>     // Relative to config? (e.g. for autostart)
>     Q_FOREACH (const QString &dir,
> QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
>         if (path.startsWith(dir) + '/') {
>
> because path.startsWith(dir) returns "bool" and '/' is a character.
> HOW can be the "+" be made and what is the type of the result?

The result is an int that is always non-zero, so the if condition is
always true. Looks like a bug to me :) Probably the intention was if
(path.startsWith(dir + '/'))

-- 
Nicolás


More information about the Kde-frameworks-devel mailing list