diff --git a/core/AMBuilder b/core/AMBuilder index 6e16a480..caa8c32f 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -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]