diff options
Diffstat (limited to 'ooo-help-parser.py')
-rwxr-xr-x | ooo-help-parser.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ooo-help-parser.py b/ooo-help-parser.py index d91f08c..c96dee0 100755 --- a/ooo-help-parser.py +++ b/ooo-help-parser.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import sys, os.path, optparse +import sys, os, os.path, optparse sys.path.append(sys.path[0]+"/source") import globals, expatimpl @@ -14,6 +14,18 @@ def main (): parser.print_help() sys.exit(1) + filepaths = [] + for fpath in args: + if os.path.isdir(fpath): + # get all .xhp files recursively under this directory. + for root, dirs, files in os.walk(fpath): + for file in files: + if os.path.splitext(file)[1] == '.xhp': + filepaths.append(root + '/' + file) + elif os.path.isfile(fpath): + if os.path.splitext(fpath)[1] == '.xhp': + filepaths.append(os.path.abspath(fpath)) + fd = sys.stdout if options.output != None: if os.path.isdir(options.output): @@ -22,11 +34,7 @@ def main (): fd = open(options.output, 'w') filesParsed = 0 - for fpath in args: - if not os.path.isfile(fpath): - globals.error(fpath + " is not a valid file. Skipping.") - continue - + for fpath in filepaths: # globals.info("processing " + fpath) file = open(fpath, 'r') strm = file.read() |