def __ScanSubdirectories(self, scanPath: str,
                          appInfoFilename: str) -> List[str]:
     filesFound = IOUtil.GetFilePaths(scanPath, appInfoFilename)
     return [
         entry for entry in filesFound
         if IOUtil.GetFileName(entry) == appInfoFilename
     ]
Esempio n. 2
0
 def __AppendDirectory(self, log: Log,
                       rUniqueFiles: Dict[str, ContentFileRecord],
                       rFiles: List[ContentFileRecord],
                       sourceRoot: ContentRootRecord, sourceEntry: str,
                       absolutePath: str) -> None:
     newFiles = IOUtil.GetFilePaths(absolutePath, None)
     for entry in newFiles:
         self.__AppendFile(log, rUniqueFiles, rFiles, sourceRoot,
                           sourceEntry, entry)
 def __ScanForTemplates(self, log: Log, path: str) -> List[XmlNewVSProjectTemplateFile]:
     files = IOUtil.GetFilePaths(path, self.TemplateFileName)
     templateList = []  # type: List[XmlNewVSProjectTemplateFile]
     for filename in files:
         template = self.__TryLoadTemplate(log, filename)
         if template is not None:
             templateList.append(template)
         else:
             log.LogPrint("Failed to load template '{0}'".format(filename))
     return templateList
Esempio n. 4
0
    def ClaimInstallDirNow(log: Log,
                           targetPath: str,
                           dstFilePath: str,
                           sdkPath: str,
                           forceClaimInstallArea: bool,
                           logWarning: bool = True) -> JsonDictType:
        # Since we are claiming the install area, we check to see if its empty as expected
        files = IOUtil.GetFilePaths(targetPath, None)
        # Then give the user error about the files at the install area can be lost unless it is changed
        if len(files) > 0:
            if not forceClaimInstallArea:
                raise Exception("The install area at '{0}' was unclaimed, but it was not empty. To allow the tool to use the directory and do with its content as it see fit.\nYou need to rerun the command with the --ForceClaimInstallArea parameter to allow it, but BEWARE that doing so means the content of '{0}' can be lost".format(targetPath))
            if logWarning:
                log.DoPrintWarning("The install area was not empty but the user enabled --ForceClaimInstallArea and allowed the tool to use it, the files there could be lost because of it.")

        # then save the claim file
        return BuildAreaInfoFileUtil.SaveInstallAreaInfo(dstFilePath, sdkPath)
 def __GetTemplateFiles(self, copyFrom: str) -> List[TemplateFileRecord]:
     skip = len(copyFrom) + 1
     files = []  # type: List[TemplateFileRecord]
     for file in IOUtil.GetFilePaths(copyFrom, None):
         files.append(TemplateFileRecord(file[skip:], copyFrom))
     return files