aboutsummaryrefslogtreecommitdiffstats
path: root/glob.go
diff options
context:
space:
mode:
Diffstat (limited to 'glob.go')
-rw-r--r--glob.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/glob.go b/glob.go
index 3497236..f3eb1b1 100644
--- a/glob.go
+++ b/glob.go
@@ -15,9 +15,11 @@
package blueprint
import (
+ "crypto/md5"
"fmt"
"reflect"
"sort"
+ "strings"
)
type GlobPath struct {
@@ -106,9 +108,16 @@ func globToString(pattern string) string {
}
func globToFileName(pattern string, excludes []string) string {
- ret := globToString(pattern)
+ name := globToString(pattern)
+ excludeName := ""
for _, e := range excludes {
- ret += "__" + globToString(e)
+ excludeName += "__" + globToString(e)
}
- return ret + ".glob"
+
+ // Prevent file names from reaching ninja's path component limit
+ if strings.Count(name, "/")+strings.Count(excludeName, "/") > 30 {
+ excludeName = fmt.Sprintf("___%x", md5.Sum([]byte(excludeName)))
+ }
+
+ return name + excludeName + ".glob"
}