def __CacheTemplateLocations(self, config: Config) -> Dict[str, str]: """ Build a dict of all *.gen files found in the template import directories """ resDict = {} # type: Dict[str, str] for location in config.TemplateImportDirectories: files = IOUtil.GetFilesAt(location.ResolvedPath, True) for entry in files: if entry.endswith(".gen"): resDict[IOUtil.GetFileNameWithoutExtension(entry)] = IOUtil.Join(location.ResolvedPath, entry) return resDict
def __AddFiles(self, fileConfigs: List[FileConfig], sourcePath: str, projectSourcePath: str) -> None: if not IOUtil.IsDirectory(sourcePath): return files = IOUtil.GetFilesAt(sourcePath, False) newFiles = [] for file in files: if not self.__IsRegistered(fileConfigs, IOUtil.Join(sourcePath, file)): newFiles.append(file) for newFile in newFiles: self.Files.append(FileConfig(IOUtil.Join(sourcePath, newFile), IOUtil.Join(projectSourcePath, newFile)))
def __AppendFilesUsingWildcard(self, log: Log, rUniqueFiles: Dict[str, ContentFileRecord], rFiles: List[ContentFileRecord], sourceRoot: ContentRootRecord, sourceEntry: str, absolutePath: str, directory: str, filename: str) -> None: if not IOUtil.IsDirectory(directory): raise Exception("No directory named '{0}' found".format(directory)) candidateFiles = IOUtil.GetFilesAt(directory, False) for candidate in candidateFiles: if fnmatch.fnmatch(candidate, filename): absPath = IOUtil.Join(directory, candidate) self.__AppendFile(log, rUniqueFiles, rFiles, sourceRoot, sourceEntry, absPath)
def __BuildCompilerFileDict(self, basePath: str) -> Dict[str, List[str]]: compilerDependentFilePath = IOUtil.Join(basePath, "CompilerId") if not IOUtil.IsDirectory(compilerDependentFilePath): return dict() foundDirs = IOUtil.GetDirectoriesAt(compilerDependentFilePath, False) if len(foundDirs) <= 0: return dict() result = dict() # type: Dict[str, List[str]] for dirName in foundDirs: absDirName = IOUtil.Join(compilerDependentFilePath, dirName) foundFiles = IOUtil.GetFilesAt(absDirName, True) if len(foundFiles) > 0: result[dirName] = foundFiles return result