// FilterMetadataItem returns true if the path meets the filter criteria, otherwise it returns false
FilterMetadataItem returns true if the path meets the filter criteria, otherwise it returns false
// FilterMetadataItem returns true if the path meets the filter criteria otherwise it returns false
func (m Metadata) FilterMetadataItem(relativeFilePath string) bool {
	cleanRelativeFilePath := fromWindowsPath(relativeFilePath)
	directory := filepath.Dir(cleanRelativeFilePath)
	baseName := filepath.Base(cleanRelativeFilePath)
	dirSplit := strings.Split(directory, string(filepath.Separator))
	metadataType, subFolders := dirSplit[0], dirSplit[1:]
	filePathArray := append(subFolders, baseName)
	filePath := strings.Join(filePathArray, string(filepath.Separator))
	validMetadataNames := m.GetNamesForType(metadataType)
	if validMetadataNames == nil || len(validMetadataNames) == 0 {
		return false
	}
	if StringSliceContainsKey(validMetadataNames, strings.TrimSuffix(filePath, ".json")) {
		return true
	}
	if StringSliceContainsKey(validMetadataNames, filePath) {
		return true
	}
	if metadataType == "componentpacks" {
		filePathParts := strings.Split(filePath, string(filepath.Separator))
		if len(filePathParts) == 2 && StringSliceContainsKey(validMetadataNames, filePathParts[0]) {
			return true
		}
	}
	if StringSliceContainsKey(validMetadataNames, strings.TrimSuffix(filePath, ".xml")) {
		return true
	}
	if StringSliceContainsKey(validMetadataNames, strings.TrimSuffix(filePath, ".skuid.json")) {
		return true
	}
	if StringSliceContainsKey(validMetadataNames, strings.TrimSuffix(filePath, ".inline.css")) {
		return true
	}
	return false
}
func ( m Metadata ) FilterMetadataItem ( relativeFilePath string ) bool { cleanRelativeFilePath := fromWindowsPath ( relativeFilePath ) directory := filepath . Dir ( cleanRelativeFilePath ) baseName := filepath . Base ( cleanRelativeFilePath ) dirSplit := strings . Split ( directory , string ( filepath . Separator ) ) metadataType , subFolders := dirSplit [ 0 ] , dirSplit [ 1 : ] filePathArray := append ( subFolders , baseName ) filePath := strings . Join ( filePathArray , string ( filepath . Separator ) ) validMetadataNames := m . GetNamesForType ( metadataType ) if validMetadataNames == nil || len ( validMetadataNames ) == 0 { return false } if StringSliceContainsKey ( validMetadataNames , strings . TrimSuffix ( filePath , " " ) ) { return true } if StringSliceContainsKey ( validMetadataNames , filePath ) { return true } if metadataType == " " { filePathParts := strings . Split ( filePath , string ( filepath . Separator ) ) if len ( filePathParts ) == 2 && StringSliceContainsKey ( validMetadataNames , filePathParts [ 0 ] ) { return true } } if StringSliceContainsKey ( validMetadataNames , strings . TrimSuffix ( filePath , " " ) ) { return true } if StringSliceContainsKey ( validMetadataNames , strings . TrimSuffix ( filePath , " " ) ) { return true } if StringSliceContainsKey ( validMetadataNames , strings . TrimSuffix ( filePath , " " ) ) { return true } return false }
FilterMetadataItem returns true if the path meets the filter criteria, otherwise it returns false
FilterMetadataItem returns true if the path meets the filter criteria otherwise it returns false
// Find the lowest level folder // If we don't have valid names for this directory, just skip this file // Most common case --- check for our metadata with .json stripped // See if our filePath is in the valid metadata, if so, we're done // Check for children of a component pack // Check for our metadata with .xml stripped // Check for our metadata with .skuid.json stripped // Check for theme inline css