def match_file(filepath): fp = filepath exists = io.ifile_exists(fp) if not exists: stem, ext = os.path.splitext(fp) if ext.lower() == '.pas': fp = stem + '.dcu' exists = io.ifile_exists(fp) return exists and (True, fp) or (False, filepath)
def verify(graph): df = graph.rootnode nodes = df.collect_nodes(DelphiFile.NodePredicates.path_not_in(graph.stdlibpath)) # if the file wasn't found during indexing there is no point complaining # about it now nodes = filter(lambda n: n.exists, nodes) fps = map(lambda n: n.filepath, nodes) notfounds = [] exit = 0 for fp in fps: if not io.ifile_exists(os.path.join(graph.abspath, fp)): notfounds.append(fp) if notfounds: exit = 1 io.output('Files not found:\n') for fp in notfounds: io.output(' * %s\n' % fp) return exit