Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to add multiple files from one folder #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions core/AMBuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os

# Function to add multiple files from one folder
# e.g. in binary.sources adding *addFromFolder to unpack the list.
def addFromFolder(path, extension=".cpp", recursive=False):
fileSelection = []

for root, dirs, files in os.walk(path):
for file in files:
if file.endswith(extension):
fileSelection.append( os.path.join(root, file) )

if not recursive:
break # no recursive

return fileSelection

def getFolders(base_folder, recursive=True):
folder_list = []
for root, dirs, files in os.walk(base_folder):
if recursive:
folder_list.extend([os.path.join(root, folder) for folder in dirs])
else:
folder_list.extend([os.path.join(root, folder) for folder in dirs])
break # no recursive
return folder_list

for sdk_name in MMS.sdks:
for cxx in MMS.all_targets:
sdk = MMS.sdks[sdk_name]
Expand Down