DSearchPath

from panda3d.core import DSearchPath
class DSearchPath

Bases:

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

class Results

Bases:

__getitem__(n: int) Filename
__init__()
__init__(copy: Results)
assign(copy: Results) Results
clear()

Removes all the files from the list.

getFile(n: int) Filename

Returns the nth file on the result list.

getNumFiles() int

Returns the number of files on the result list.

output(out: ostream)
size() int

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

write(out: ostream, indent_level: int)
__init__()
__init__(copy: DSearchPath)
__init__(directory: Filename)
__init__(path: str, separator: str)
appendDirectory(directory: Filename)

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

appendPath(path: DSearchPath)

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

appendPath(path: str, separator: str)

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

assign(copy: DSearchPath) DSearchPath
clear()

Removes all the directories from the search list.

property directories Sequence[Filename]

Returns the nth directory on the search list.

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.

findAllFiles(filename: Filename, results: Results) int

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.

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.

getDirectories() list
getDirectory(n: int) Filename

Returns the nth directory on the search list.

getNumDirectories() int

Returns the number of directories on the search list.

isEmpty() bool

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

output(out: ostream, separator: str)
prependDirectory(directory: Filename)

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

prependPath(path: DSearchPath)

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

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.

write(out: ostream, indent_level: int)