<table><tr><td style="">kossebau added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15797">View Revision</a></tr></table><br /><div><div><p>Hi <a href="https://phabricator.kde.org/p/rjvbb/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@rjvbb</a></p>

<p>I just came across this logic (for reasons) and wonder if the logic does what you intended with the patch:<br />
given the <tt style="background: #ebebeb; font-size: 13px;">const auto canonicalPathToCheck = checkPathIsFile ? pathInfo.canonicalFilePath() : QStringLiteral("");</tt>, when <tt style="background: #ebebeb; font-size: 13px;">checkPathIsFile</tt> is <tt style="background: #ebebeb; font-size: 13px;">false</tt>, <tt style="background: #ebebeb; font-size: 13px;">canonicalPathToCheck</tt> is an empty string.</p>

<p>Which makes those two other logic using that variable behave bogus:<br />
a) <tt style="background: #ebebeb; font-size: 13px;">(canonicalPathToCheck == projectCanonicalRootPath)</tt> will never be true, as in case of being a path to check the project root path is compared against an empty string and if a file it will be false anyway<br />
b) <tt style="background: #ebebeb; font-size: 13px;">file.startsWith(canonicalPathToCheck)</tt> will always be <tt style="background: #ebebeb; font-size: 13px;">true</tt>, so all files are added to <tt style="background: #ebebeb; font-size: 13px;">m_sources</tt> in case we have a path to check</p>

<p>So my questions:<br />
a) should <tt style="background: #ebebeb; font-size: 13px;">canonicalPathToCheck</tt> not always be <tt style="background: #ebebeb; font-size: 13px;">pathInfo.canonicalFilePath()</tt>?<br />
b) is the check of both <tt style="background: #ebebeb; font-size: 13px;">file.startsWith(m_checkPath) || file.startsWith(canonicalPathToCheck)</tt>the intended check?</p>

<p>I assume 2x yes, but given this patch was written by one person and reviewed by another, I am not sure if my first coffee was too weak ;)</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15797">https://phabricator.kde.org/D15797</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, antonanikin, mwolff<br /><strong>Cc: </strong>kossebau, mwolff, antonanikin, kdevelop-devel, hmitonneau, christiant, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>