示例#1
0
文件: build.go 项目: get3w/get3w
func (parser *Parser) buildCopy(excludeKeys, includeKeys []string) error {
	files, err := parser.Storage.GetAllFiles(parser.Storage.GetSourcePrefix(""))
	if err != nil {
		return err
	}

	for _, file := range files {
		if file.IsDir || isUnderscoreOrDotPrefix(file.Path) {
			continue
		}
		sourceKey := parser.Storage.GetSourceKey(file.Path)
		destinationKey := parser.Storage.GetDestinationKey(file.Path)

		if stringutils.HasPrefixIgnoreCase(excludeKeys, sourceKey) {
			if !stringutils.HasPrefixIgnoreCase(includeKeys, sourceKey) {
				continue
			}
		}

		err := parser.Storage.CopyToDestination(sourceKey, destinationKey)
		if err != nil {
			return err
		}
	}

	return nil
}
示例#2
0
文件: utils.go 项目: get3w/get3w
// IsLocalFile returns true if the file is local only
func (parser *Parser) IsLocalFile(file *get3w.File) bool {
	if strings.HasPrefix(file.Path, parser.Config.Destination) {
		return true
	}
	if stringutils.HasPrefixIgnoreCase(localOnlyPrefixes, file.Path) {
		return true
	}
	return false
}