'Add a new path to the list of search paths. Return False if the
path does not exist.
:param path: The new search path. Relative paths are turned into
an absolute and normalized form. If the path looks like a file
(not ending in `/`), the filename is stripped off.
:param base: Path used to absolutize relative search paths.
Defaults to :attr:`base` which defaults to ``os.getcwd()``.
:param index: Position within the list of search paths. Defaults
to last index (appends to the list).
The `base` parameter makes it easy to reference files installed
along with a python module or package::
res.add_path(\'./resources/\', __file__)'

def add_path(self, path, base=None, index=None, create=False):

    base = os.path.abspath(os.path.dirname((base or self.base)))
    path = os.path.abspath(os.path.join(base, os.path.dirname(path)))
    path += os.sep
    if (path in self.path):
        self.path.remove(path)
    if (create and (not os.path.isdir(path))):
        os.makedirs(path)
    if (index is None):
        self.path.append(path)
    else:
        self.path.insert(index, path)
    self.cache.clear()
    return os.path.exists(path)
