panda3d.core.DSearchPath

class DSearchPath

This class stores a list of directories that can be searched, in order, to locate a particular file. It is normally constructed by passing it a traditional searchpath-style string, e.g. a list of directory names delimited by spaces or colons, but it can also be built up explicitly.

Inheritance diagram

Inheritance diagram of DSearchPath

__init__() → None
__init__(from: DSearchPath) → None
__init__(copy: DSearchPath) → None
__init__(directory: Filename) → None
__init__(path: str, separator: str) → None
assign(from: DSearchPath) → DSearchPath
Return type

DSearchPath

assign(copy: DSearchPath) → DSearchPath
Return type

DSearchPath

clear() → None

Removes all the directories from the search list.

appendDirectory(directory: Filename) → None

Adds a new directory to the end of the search list.

prependDirectory(directory: Filename) → None

Adds a new directory to the front of the search list.

appendPath(path: DSearchPath) → None

Adds all of the directories listed in the search path to the end of the search list.

appendPath(path: str, separator: str) → None

Adds all of the directories listed in the search path to the end of the search list.

prependPath(path: DSearchPath) → None

Adds all of the directories listed in the search path to the beginning of the search list.

isEmpty() → bool

Returns true if the search list is empty, false otherwise.

getNumDirectories() → size_t

Returns the number of directories on the search list.

Return type

size_t

getDirectory(n: size_t) → Filename

Returns the nth directory on the search list.

Return type

Filename

findFile(filename: Filename) → Filename

Searches all the directories in the search list for the indicated file, in order. Returns the full matching pathname of the first match if found, or the empty string if not found.

Return type

Filename

findAllFiles(filename: Filename) → Results

This variant of findAllFiles() returns the new Results object, instead of filling on in on the parameter list. This is a little more convenient to call from Python.

Return type

Results

findAllFiles(filename: Filename, results: Results) → size_t

Searches all the directories in the search list for the indicated file, in order. Fills up the results list with all of the matching filenames found, if any. Returns the number of matches found.

It is the responsibility of the the caller to clear the results list first; otherwise, the newly-found files will be appended to the list.

Return type

size_t

static searchPath(filename: Filename, path: str, separator: str) → Filename

A quick-and-easy way to search a searchpath for a file when you don’t feel like building or keeping around a DSearchPath object. This simply constructs a temporary DSearchPath based on the indicated path string, and searches that.

Return type

Filename

output(out: ostream, separator: str) → None
write(out: ostream, indent_level: int) → None
getDirectories() → list
property directories

Returns the nth directory on the search list.

Return type

Sequence[Filename]

class Results
__init__() → None
__init__(copy: Results) → None
assign(copy: Results) → Results
Return type

Results

clear() → None

Removes all the files from the list.

getNumFiles() → size_t

Returns the number of files on the result list.

Return type

size_t

getFile(n: size_t) → Filename

Returns the nth file on the result list.

Return type

Filename

size() → size_t

Returns the num of filenames in the set. This method is defined to make the Results object appear to be a list in Python.

Return type

size_t

output(out: ostream) → None
write(out: ostream, indent_level: int) → None