MaterialX 1.39.1
Loading...
Searching...
No Matches
FileSearchPath Class Reference

A sequence of file paths, which may be queried to find the first instance of a given filename on the file system. More...

#include <File.h>

Public Types

using Iterator = FilePathVec::iterator
 
using ConstIterator = FilePathVec::const_iterator
 

Public Member Functions

 FileSearchPath (const string &searchPath, const string &sep=PATH_LIST_SEPARATOR)
 Construct a search path from a string. More...
 
string asString (const string &sep=PATH_LIST_SEPARATOR) const
 Convert this sequence to a string using the given separator.
 
void append (const FilePath &path)
 Append the given path to the sequence.
 
void append (const FileSearchPath &searchPath)
 Append the given search path to the sequence.
 
void prepend (const FilePath &path)
 Prepend the given path to the sequence.
 
void clear ()
 Clear all paths from the sequence.
 
size_t size () const
 Return the number of paths in the sequence.
 
bool isEmpty () const
 Return true if the search path is empty.
 
FilePathoperator[] (size_t index)
 Return the path at the given index.
 
const FilePathoperator[] (size_t index) const
 Return the const path at the given index.
 
FilePath find (const FilePath &filename) const
 Given an input filename, iterate through each path in this sequence, returning the first combined path found on the file system. More...
 
Iterators
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 

Detailed Description

A sequence of file paths, which may be queried to find the first instance of a given filename on the file system.

Constructor & Destructor Documentation

◆ FileSearchPath()

FileSearchPath ( const string &  searchPath,
const string &  sep = PATH_LIST_SEPARATOR 
)
inline

Construct a search path from a string.

Parameters
searchPathA string containing a sequence of file paths joined by separator characters.
sepThe set of separator characters used in the search path. Defaults to the PATH_LIST_SEPARATOR character.

Member Function Documentation

◆ find()

FilePath find ( const FilePath filename) const
inline

Given an input filename, iterate through each path in this sequence, returning the first combined path found on the file system.

On success, the combined path is returned; otherwise the original filename is returned unmodified.


The documentation for this class was generated from the following file: