76 [[
deprecated (
"This class is now deprecated in favour of RangedDirectoryIterator.")]]
80 int type = File::findFiles,
105 bool next (
bool* isDirectory,
116 const File& getFile()
const;
123 float getEstimatedProgress()
const;
126 using KnownPaths = std::set<File>;
134 : wildCards (parseWildcards (
pattern)),
135 fileFinder (directory, (
recursive || wildCards.size() > 1) ?
"*" :
pattern),
137 path (
File::addTrailingSeparator (directory.getFullPathName())),
138 whatToLookFor (type),
144 jassert ((whatToLookFor & (File::findFiles | File::findDirectories)) != 0);
145 jassert (whatToLookFor > 0 && whatToLookFor <= 7);
147 if (followSymlinks == File::FollowSymlinks::noCycles)
149 if (knownPaths ==
nullptr)
151 heapKnownPaths = std::make_unique<KnownPaths>();
152 knownPaths = heapKnownPaths.get();
155 knownPaths->insert (directory);
160 struct NativeIterator
162 NativeIterator (
const File& directory,
const String& wildCard);
165 bool next (String& filenameFound,
166 bool* isDirectory,
bool* isHidden, int64* fileSize,
167 Time* modTime, Time* creationTime,
bool* isReadOnly);
170 std::unique_ptr<Pimpl> pimpl;
172 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeIterator)
175 StringArray wildCards;
176 NativeIterator fileFinder;
177 String wildCard, path;
179 mutable int totalNumFiles = -1;
180 const int whatToLookFor;
181 const bool isRecursive;
182 bool hasBeenAdvanced =
false;
183 std::unique_ptr<DirectoryIterator> subIterator;
185 File::FollowSymlinks followSymlinks = File::FollowSymlinks::yes;
186 KnownPaths* knownPaths =
nullptr;
187 std::unique_ptr<KnownPaths> heapKnownPaths;
189 static StringArray parseWildcards (
const String& pattern);
190 static bool fileMatches (
const StringArray& wildCards,
const String& filename);
192 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryIterator)