readDefFiles function
dynamic
readDefFiles(
- List<
String> pathArray, { - String baseFolderPath = '',
- String filePath = '',
- String readTextFileFunction(])? = readTextFile,
- String stringProcessingQuote = '\'',
- dynamic processQuotedStringFunction()? = processDefQuotedString,
- int levelSpaceCount = 4,
- bool hasImportCommands = true,
- String getImportedPathFunction()? = getImportedPath,
- List<
String> getImportedFilePathArrayFunction()? = getImportedFilePathArray,
Implementation
dynamic readDefFiles(
List<String> pathArray,
{
String baseFolderPath = '',
String filePath = '',
String Function( String, [String] )? readTextFileFunction = readTextFile,
String stringProcessingQuote = '\'',
dynamic Function( String, ParsingContext, int )? processQuotedStringFunction = processDefQuotedString,
int levelSpaceCount = 4,
bool hasImportCommands = true,
String Function( String )? getImportedPathFunction = getImportedPath,
List<String> Function( String )? getImportedFilePathArrayFunction = getImportedFilePathArray
}
)
{
var scriptFolderPath = getDefFolderPath( filePath );
var valueArray = <dynamic>[];
for ( var path in pathArray )
{
if ( path.endsWith( '/' )
|| path.contains( '*' )
|| path.contains( '?' ) )
{
var folderFilePathArray = getDefFilePathArray( scriptFolderPath + path );
for ( var folderFilePath in folderFilePathArray )
{
valueArray.add(
readDefFile(
folderFilePath,
baseFolderPath: baseFolderPath,
readTextFileFunction: readTextFileFunction,
stringProcessingQuote: stringProcessingQuote,
processQuotedStringFunction: processQuotedStringFunction,
levelSpaceCount: levelSpaceCount,
hasImportCommands: hasImportCommands,
getImportedPathFunction: getImportedPathFunction,
getImportedFilePathArrayFunction: getImportedFilePathArrayFunction
)
);
}
}
else
{
dynamic value =
readDefFile(
scriptFolderPath + path,
baseFolderPath: baseFolderPath,
readTextFileFunction: readTextFileFunction,
stringProcessingQuote: stringProcessingQuote,
processQuotedStringFunction: processQuotedStringFunction,
levelSpaceCount: levelSpaceCount,
hasImportCommands: hasImportCommands,
getImportedPathFunction: getImportedPathFunction,
getImportedFilePathArrayFunction: getImportedFilePathArrayFunction
);
if ( pathArray.length == 1 )
{
return value;
}
else
{
valueArray.add( value );
}
}
}
return valueArray;
}