| 582 | } |
| 583 | |
| 584 | bool 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 | |
| 624 | bool FileAccess::isFile() const |
| 625 | { |
no outgoing calls