def getPhobosConfigPath(): """Returns the user-defined config path if set or the default-path Returns(str): (user-defined) config path """ if bpy.context.user_preferences.addons["phobos"].preferences.configfolder != '': return bpy.context.user_preferences.addons["phobos"].preferences.configfolder else: # the following if copied from setup.py, may be imported somehow in the future return getConfigPath()
def getPhobosConfigPath(): """Returns the user-defined config path if set or the default-path Returns(str): (user-defined) config path Args: Returns: """ if bpy.context.user_preferences.addons["phobos"].preferences.configfolder != '': return bpy.context.user_preferences.addons["phobos"].preferences.configfolder else: # the following if copied from setup.py, may be imported somehow in the future return getConfigPath()
:return: dictionary containing all parsed YAML files :rtype: dict """ dicts = [] for file in glob.iglob(os.path.join(path, '**/*.yml'), recursive=True): print(' ' + os.path.basename(file)) try: with open(os.path.join(path, file), 'r') as f: tmpstring = f.read() try: tmpyaml = yaml.load(__evaluateString(tmpstring)) if not tmpyaml: print(file + " does not contain any yaml information.") continue dicts.append(tmpyaml) except yaml.scanner.ScannerError as e: print( os.path.relpath(file, path) + " could not be parsed:\n" + str(e)) except FileNotFoundError: print(os.path.relpath(file, path=path) + " was not found.") return dicts # Update definitions from files definitionpath = os.path.join(phobossystem.getConfigPath() + '/definitions') print("Parsing definitions from:", definitionpath) updateDefs(definitionpath)
:param path: path from which to parse all files :type path: str :return: dictionary containing all parsed YAML files :rtype: dict """ dicts = [] for file in glob.iglob(os.path.join(path, '**/*.yml'), recursive=True): print(' ' + os.path.basename(file)) try: with open(os.path.join(path, file), 'r') as f: tmpstring = f.read() try: tmpyaml = yaml.load(__evaluateString(tmpstring)) if not tmpyaml: print(file + " does not contain any yaml information.") continue dicts.append(tmpyaml) except yaml.scanner.ScannerError as e: print(os.path.relpath(file, path) + " could not be parsed:\n" + str(e)) except FileNotFoundError: print(os.path.relpath(file, path=path) + " was not found.") return dicts # Update definitions from files definitionpath = os.path.join(phobossystem.getConfigPath() + '/definitions') print("Parsing definitions from:", definitionpath) updateDefs(definitionpath)