Game Logic: getBlendFileList

getBlendFileList()
  • Returns a list of the blend files in the same directory as the open blend.

Return Type:

  • list [ string ]
getBlendFileList(dirPath)
  • Returns a list of the blend files in a directory.

Return Type:

  • list [ string ]

dirPath:

  • Type:  string
Note:
  • "//" = the directory of the blend that is currently running
     
  • Use / as directory separator in a path
     
  • You can include subdirectories in the path by using ("//" + "subdir_name\\")
Sample Code

################## get a list of blends in the same directory as open blend
 
# import bge

import bge

# get a list of the blends in the same directory as open blend
blendList = bge.logic.getBlendFileList()

Sample Code

################## get a list of blends in a subdirectory
 
# import bge

import bge

# subdirectory named Levels
dirPath = "//" + "Levels\\"

# get a list of the blends in subDirectory
levels_blendList = bge.logic.getBlendFileList(dirPath)