diff options
author | Akaash Suresh <casa.akaash@gmail.com> | 2020-02-22 22:57:19 -0600 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2020-03-26 00:42:13 -0700 |
commit | f4b460c20042b1d04abab1931f81513ac0031c37 (patch) | |
tree | a6244e008533a6454f889debfedf3a79075d8cd2 /lib/python/qmk/path.py | |
parent | 12d532d778e37d29b4dca8726dfffcaa17f311cb (diff) |
New functionality for cformat (#7893)
Fixing complexity
remove lambda
PR review fixes #1
Removing unneccesary string substitution
Handle -a and specified files
Complexity rewrite, use pathlib
Diffstat (limited to 'lib/python/qmk/path.py')
-rw-r--r-- | lib/python/qmk/path.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py index d16928afb5..bfaa439249 100644 --- a/lib/python/qmk/path.py +++ b/lib/python/qmk/path.py @@ -68,3 +68,17 @@ def normpath(path): return Path(path) return Path(os.environ['ORIG_CWD']) / path + + +def c_source_files(dir_names): + """Returns a list of all *.c, *.h, and *.cpp files for a given list of directories + + Args: + + dir_names + List of directories, relative pathing starts at qmk's cwd + """ + files = [] + for dir in dir_names: + files.extend(file for file in Path(dir).glob('**/*') if file.suffix in ['.c', '.h', '.cpp']) + return files |