From 0a89675cca6905eb85bcf7d3d1258cf89a8f3769 Mon Sep 17 00:00:00 2001 From: ktyl Date: Fri, 27 May 2022 00:34:04 +0100 Subject: [PATCH] allow multiple include dirs --- ppp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ppp.py b/ppp.py index 285cf8a..23ff967 100644 --- a/ppp.py +++ b/ppp.py @@ -11,6 +11,8 @@ if argc < 3: print_usage() sys.exit(1) +includes = sys.argv[2:] + # figure out src dir from root argument sep="/" src_dir = sep.join(sys.argv[2].split(sep)[:-1]) @@ -36,7 +38,13 @@ def preprocess_file(path): include_path = l.split(" ")[1] # prepend directory - include_path = "/".join([src_dir, include_path]) + #include_path = "/".join([src_dir, include_path]) + for inc in includes: + if os.path.basename(inc) == include_path: + include_path = inc + break + + print(include_path) preprocess_file(include_path) continue