コード例 #1
0
    def addCustomDataToCPropertiesFile(self, cProperties, makefileData, buildData):
        '''
        TODO USER Add custom data to 'c_cpp_properties.json' file.
        '''
        cProperties["configurations"][0]["name"] = utils.getWorkspaceName()

        # TODO USER can add other specific here
        # Note: be careful not to override other parameters that are added from 'Makefile' and 'buildData.json'

        return cProperties
コード例 #2
0
    def checkWorkspaceFile(self):
        '''
        Check if workspace '*.code-workspace' file exists. If it does, check if it is a valid JSON file.
        If it doesn't exist report error and quit.
        '''
        workspaceFileName = utils.getWorkspaceName()
        if utils.fileFolderExists(utils.workspaceFilePath):
            # file exists, check if it loads OK
            try:
                with open(utils.workspaceFilePath, 'r') as workspaceFile:
                    workspaceFileData = json.load(workspaceFile)

                    print("Existing " + workspaceFileName + " file found.")

            except Exception as err:
                errorMsg = "Invalid " + workspaceFileName + " file.\n"
                errorMsg += "Possible cause: invalid json format or comments (not supported by this scripts). Error:\n"
                errorMsg += str(err)
                print(errorMsg)