panda3d.core.ConfigVariableSearchPath

from panda3d.core import ConfigVariableSearchPath
class ConfigVariableSearchPath

Bases: ConfigVariableBase

This is similar to a ConfigVariableList, but it returns its list as a DSearchPath, as a list of directories.

You may locally append directories to the end of the search path with the methods here, or prepend them to the beginning. Use these methods to make adjustments to the path; do not attempt to directly modify the const DSearchPath object returned by getValue().

Unlike other ConfigVariable types, local changes (made by calling appendDirectory() and prependDirectory()) are specific to this particular instance of the ConfigVariableSearchPath. A separate instance of the same variable, created by using the same name to the constructor, will not reflect the local changes.

Inheritance diagram

Inheritance diagram of ConfigVariableSearchPath

__init__(name: str, default_value: DSearchPath, description: str, flags: int) → None
__init__(name: str, description: str, flags: int) → None
__init__(name: str, default_value: str, description: str, flags: int) → None
getValue() → DSearchPath
Return type

DSearchPath

getDefaultValue() → DSearchPath
Return type

DSearchPath

clearLocalValue() → bool

Removes all the directories locally added to the search list, and restores it to its original form.

clear() → None

Removes all the directories locally added to the search list, and restores it to its original form.

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

output(out: ostream) → None
write(out: ostream) → None
getDirectories() → list
property value
Return type

DSearchPath

property default_value
Return type

DSearchPath

property directories

Returns the nth directory on the search list.

Return type

Sequence[Filename]