I want to test to see if a directory exists so that if it does, then getBlendFileList is used. If getBlendFileList is used and the directory isn’t found or does not exist, there is a bug in which the entire GE will crash. I therefore want to make it so I can return a directory I can specify (e.g levels) if it exists and if not, just return the result as the current directory or something else UPBGE will not crash in.
os.path.exists() to determine whether a path exists.
import bge def main(self): if os.path.exists("D:\\Blender\\Projects"): print("File-path exists.") else: print("File-path doesn't exist.")