def collect_fonts(): """Collect a list of all font filenames.""" #try first with locate otherwise with find for command in LOCATE: try: if system.find_exe(command[0]): output = locate_files(command) files = [line for line in output if line[-4:].lower() in ['.ttf', '.otf']] if files: return files except: pass from other.findsystem import findFonts return findFonts()
def collect_fonts(): """Collect a list of all font filenames.""" #try first with locate otherwise with find output = set() for command in LOCATE: try: if system.find_exe(command[0]): output = output.union(locate_files(command)) except: pass files = [ line for line in output if line[-4:].lower() in ['.ttf', '.otf'] ] # was locate or mdfind succesfull? if files: return files # emergency solution from other.findsystem import findFonts return findFonts()
def collect_fonts(): """Collect a list of all font filenames.""" return findFonts()