35 : directories (other.directories)
41 directories = other.directories;
51 void FileSearchPath::init (
const String& path)
58 for (
auto& d : directories)
64 return directories.
size();
69 return File (directories[index]);
74 auto dirs = directories;
77 if (d.containsChar (
';'))
90 for (
auto& d : directories)
100 directories.
remove (index);
111 for (
int i = directories.
size(); --i >= 0;)
113 const File d1 (directories[i]);
115 for (
int j = directories.
size(); --j >= 0;)
117 const File d2 (directories[j]);
119 if (i != j && (d1.
isAChildOf (d2) || d1 == d2))
130 for (
int i = directories.
size(); --i >= 0;)
143 bool recurse,
const String& wildcard)
const 147 for (
auto& d : directories)
154 const bool checkRecursively)
const 156 for (
auto& d : directories)
158 if (checkRecursively)
FileSearchPath()
Creates an empty search path.
void addPath(const FileSearchPath &)
Merges another search path into this one.
void removeNonExistentPaths()
Removes any directories that don't actually exist.
String toString() const
Returns the search path as a semicolon-separated list of directories.
bool isAChildOf(const File &potentialParentDirectory) const
Checks whether a file is somewhere inside a directory.
Represents a set of folders that make up a search path.
File getParentDirectory() const
Returns the directory that contains this file or directory.
int getNumPaths() const
Returns the number of folders in this search path.
void removeEmptyStrings(bool removeWhitespaceStrings=true)
Removes empty strings from the array.
void remove(int index)
Removes a string from the array.
Array< File > findChildFiles(int whatToLookFor, bool searchRecursively, const String &wildCardPattern="*") const
Searches the path for a wildcard.
bool isFileInPath(const File &fileToCheck, bool checkRecursively) const
Finds out whether a file is inside one of the path's directories.
void trim()
Deletes any whitespace characters from the starts and ends of all the strings.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
void removeRedundantPaths()
Removes any directories that are actually subdirectories of one of the other directories in the searc...
void remove(int indexToRemove)
Removes a directory from the search path.
bool addIfNotAlreadyThere(const File &directoryToAdd)
Adds a new directory to the search path if it's not already in there.
void clear()
Removes all elements from the array.
Array< File > findChildFiles(int whatToLookFor, bool searchRecursively, const String &wildCardPattern="*") const
Searches this directory for files matching a wildcard pattern.
Represents a local file or directory.
Holds a resizable array of primitive or copy-by-value objects.
File operator[](int index) const
Returns one of the folders in this search path.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
void insert(int index, String stringToAdd)
Inserts a string into the array.
int size() const noexcept
Returns the number of strings in the array.
FileSearchPath & operator=(const FileSearchPath &)
Copies another search path.
bool isDirectory() const
Checks whether the file is a directory that exists.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
~FileSearchPath()
Destructor.
void add(const File &directoryToAdd, int insertIndex=-1)
Adds a new directory to the search path.