File indexing completed on 2024-05-19 13:31:39

0001 // clang-format off
0002 /*
0003  * KDiff3 - Text Diff And Merge Tool
0004  *
0005  * SPDX-FileCopyrightText: 2021-2021 Michael Reeves reeves.87@gmail.com
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 // clang-format on
0009 
0010 #include "DirectoryInfo.h"
0011 
0012 #include "CompositeIgnoreList.h"
0013 #include "CvsIgnoreList.h"
0014 #include "GitIgnoreList.h"
0015 
0016 #include <memory>
0017 
0018 extern std::unique_ptr<Options> gOptions;
0019 
0020 //Intialize with a dummy default DirectoryInfo so we don't crash on first run.
0021 QSharedPointer<DirectoryInfo>  gDirInfo = QSharedPointer<DirectoryInfo>::create();
0022 
0023 bool DirectoryInfo::listDirA()
0024 {
0025     return listDir(m_dirA, m_dirListA);
0026 }
0027 
0028 bool DirectoryInfo::listDirB()
0029 {
0030     return listDir(m_dirB, m_dirListB);
0031 }
0032 
0033 bool DirectoryInfo::listDirC()
0034 {
0035     return listDir(m_dirC, m_dirListC);
0036 }
0037 
0038 bool DirectoryInfo::listDir(FileAccess& fileAccess, DirectoryList& dirList)
0039 {
0040     CompositeIgnoreList ignoreList;
0041     if(gOptions->m_bDmUseCvsIgnore)
0042     {
0043         ignoreList.addIgnoreList(std::make_unique<CvsIgnoreList>());
0044         ignoreList.addIgnoreList(std::make_unique<GitIgnoreList>());
0045     }
0046     return fileAccess.listDir(&dirList,
0047                               gOptions->m_bDmRecursiveDirs, gOptions->m_bDmFindHidden,
0048                               gOptions->m_DmFilePattern, gOptions->m_DmFileAntiPattern,
0049                               gOptions->m_DmDirAntiPattern, gOptions->m_bDmFollowDirLinks,
0050                               ignoreList);
0051 }