import posixpath from direct.stdpy.file import walk class Package: def __init__(self, meta, mount_dir, vfs): self.meta = meta self.mount_dir = mount_dir self.vfs = vfs def all_models(self): models_path = posixpath.join(self.mount_dir, 'models') output = [] for root, paths, files in walk(models_path): rel_root = root.replace(f'{models_path}', '').strip() if len(rel_root) > 0 and rel_root[0] == '/': rel_root = rel_root[1:] for filepath in files: output.append(posixpath.join(rel_root, filepath)) return output def all_textures(self): textures_path = posixpath.join(self.mount_dir, 'textures') output = [] for root, paths, files in walk(textures_path): rel_root = root.replace(f'{textures_path}', '').strip() if len(rel_root) > 0 and rel_root[0] == '/': rel_root = rel_root[1:] for filepath in files: output.append(posixpath.join(rel_root, filepath)) return output