76 [[deprecated (
"This class is now deprecated in favour of RangedDirectoryIterator.")]]
79 const String& pattern =
"*",
105 bool next (
bool* isDirectory,
116 const File& getFile()
const;
123 float getEstimatedProgress()
const;
126 using KnownPaths = std::set<File>;
133 KnownPaths* seenPaths)
134 : wildCards (parseWildcards (pattern)),
135 fileFinder (directory, (recursive || wildCards.size() > 1) ?
"*" : pattern),
137 path (
File::addTrailingSeparator (directory.getFullPathName())),
138 whatToLookFor (type),
139 isRecursive (recursive),
140 followSymlinks (follow),
141 knownPaths (seenPaths)
145 jassert (whatToLookFor > 0 && whatToLookFor <= 7);
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;
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)
DirectoryIterator(const File &directory, bool recursive, const String &pattern="*", int type=File::findFiles, File::FollowSymlinks follow=File::FollowSymlinks::yes)