MCPcopy Create free account
hub / github.com/KDE/kdiff3 / isNormal

Method isNormal

src/fileaccess.cpp:584–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584bool FileAccess::isNormal() const
585{
586 static quint32 depth = 0;
587 /*
588 Speed is important here isNormal is called for every file during directory
589 comparison. It can therefor have great impact on overall performance.
590
591 We also need to insure that we don't keep looking indefinitely when following
592 links that point to links. Therefore we hard cap at 15 such links in a chain
593 and make sure we don't cycle back to something we already saw.
594 */
595 if(!mVisited && depth < 15 && isLocal() && isSymLink())
596 {
597 /*
598 wierd psudo-name created from commandline input redirection from output of another command.
599 KIO/Qt does not handle it as a normal file but presents it as such.
600 */
601 if(m_linkTarget.startsWith("pipe:"))
602 {
603 return false;
604 }
605
606 FileAccess target(m_linkTarget);
607
608 mVisited = true;
609 ++depth;
610 /*
611 Catch local links to special files. '/dev' has many of these.
612 */
613 bool result = target.isNormal();
614 // mVisited has done its job and should be reset here.
615 mVisited = false;
616 --depth;
617
618 return result;
619 }
620
621 return !exists() || isFile() || isDir() || isSymLink();
622}
623
624bool FileAccess::isFile() const
625{

Callers 6

copyFileMethod · 0.80
readFileMethod · 0.80
readAndPreprocessMethod · 0.80
conflictingFileTypesMethod · 0.80
fastFileComparisonMethod · 0.80
liveTestMethod · 0.80

Calls

no outgoing calls

Tested by 1

liveTestMethod · 0.64