From de50a9e073bfd75bcfbb911e271786268039fd4a Mon Sep 17 00:00:00 2001 From: Lerking Date: Mon, 17 Dec 2018 19:56:12 +0100 Subject: [PATCH] Added function to recursively traverse a directory tree and process all files ending in '.h'. --- h2inc.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/h2inc.py b/h2inc.py index bf7d7c0..479d5f2 100644 --- a/h2inc.py +++ b/h2inc.py @@ -39,6 +39,10 @@ class H2INC: else: return False + def process_directory(self): + for f in self.filelist: + self.read_file(f) + def read_file(self, fn): parse = PARSER() outfile = '' @@ -103,10 +107,7 @@ if __name__ == "__main__": app = H2INC() if app.srcfilecnt(app.sourcedir) == True: print(app.filecnt) - #print(app.filelist) if app.srcfoldercnt(app.sourcedir) == True: print(app.foldercnt) - #print(app.folderlist) - #for f in app.filelist: - #app.read_file(f) - app.read_file("./gtk.h") #testfile for comments and header includes \ No newline at end of file + #app.read_file("./gtk.h") #testfile for comments and header includes + app.process_directory() \ No newline at end of file