26StringArray DirectoryIterator::parseWildcards (
const String& pattern)
29 s.addTokens (pattern,
";,",
"\"'");
31 s.removeEmptyStrings();
35bool DirectoryIterator::fileMatches (
const StringArray& wildcards,
const String& filename)
37 for (
auto& w : wildcards)
46 return next (
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr);
49JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE (
"-Wdeprecated-declarations")
50JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
53 Time* modTime,
Time* creationTime,
bool* isReadOnly)
57 hasBeenAdvanced =
true;
59 if (subIterator !=
nullptr)
61 if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly))
68 bool isDirectory, isHidden =
false, shouldContinue =
false;
70 while (fileFinder.next (filename, &isDirectory,
72 fileSize, modTime, creationTime, isReadOnly))
83 const auto mayRecurseIntoPossibleHiddenDir = [
this, &isHidden]
88 const auto mayRecurseIntoPossibleSymlink = [
this, &fullPath]
91 || ! fullPath.isSymbolicLink()
93 && knownPaths->find (fullPath.getLinkedTarget()) == knownPaths->end());
96 if (isRecursive && mayRecurseIntoPossibleHiddenDir() && mayRecurseIntoPossibleSymlink())
97 subIterator.reset (
new DirectoryIterator (fullPath,
true, wildCard, whatToLookFor, followSymlinks, knownPaths));
107 if (matches && (isRecursive || wildCards.size() > 1))
108 matches = fileMatches (wildCards, filename);
111 matches = ! isHidden;
115 currentFile = fullPath;
116 if (isHiddenResult !=
nullptr) *isHiddenResult = isHidden;
117 if (isDirResult !=
nullptr) *isDirResult = isDirectory;
122 if (subIterator !=
nullptr)
124 shouldContinue =
true;
130 if (! shouldContinue)
135JUCE_END_IGNORE_WARNINGS_GCC_LIKE
136JUCE_END_IGNORE_WARNINGS_MSVC
140 if (subIterator !=
nullptr && subIterator->hasBeenAdvanced)
141 return subIterator->getFile();
144 jassert (hasBeenAdvanced);
151 if (totalNumFiles < 0)
154 if (totalNumFiles <= 0)
157 auto detailedIndex = (subIterator !=
nullptr) ? (
float) index + subIterator->getEstimatedProgress()
160 return jlimit (0.0f, 1.0f, detailedIndex / (
float) totalNumFiles);
const File & getFile() const
float getEstimatedProgress() const
int getNumberOfChildFiles(int whatToLookFor, const String &wildCardPattern="*") const
@ findFilesAndDirectories
static bool areFileNamesCaseSensitive()
static File createFileWithoutCheckingPath(const String &absolutePath) noexcept
bool containsOnly(StringRef charactersItMightContain) const noexcept