aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-02-06 13:33:22 -0500
committerRuss Cox <rsc@golang.org>2012-02-06 13:33:22 -0500
commite335ec98b5f897afee90462bd95cf3cec42e115a (patch)
tree5b6d8c548228d393e243b5aa6bea9217b7ef7f05 /src
parent842c906e2e9560187d4877d9f52e8f9ceb63d84c (diff)
downloadgo-e335ec98b5f897afee90462bd95cf3cec42e115a.tar.xz
cmd/dist: ignore file names beginning with . or _
This is the same heuristic that build.ScanDir uses. It avoids considering 'resource fork' files on OS X; the resource for x.go is ._x.go. R=gri CC=golang-dev https://golang.org/cl/5616073
Diffstat (limited to 'src')
-rw-r--r--src/cmd/dist/build.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index 04818e1265..54510db1da 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -555,6 +555,22 @@ install(char *dir)
// Everything in that directory, and any target-specific
// additions.
xreaddir(&files, bstr(&path));
+
+ // Remove files beginning with . or _,
+ // which are likely to be editor temporary files.
+ // This is the same heuristic build.ScanDir uses.
+ // There do exist real C files beginning with _,
+ // so limit that check to just Go files.
+ n = 0;
+ for(i=0; i<files.len; i++) {
+ p = files.p[i];
+ if(hasprefix(p, ".") || (hasprefix(p, "_") && hassuffix(p, ".go")))
+ xfree(p);
+ else
+ files.p[n++] = p;
+ }
+ files.len = n;
+
for(i=0; i<nelem(deptab); i++) {
if(hasprefix(dir, deptab[i].prefix)) {
for(j=0; (p=deptab[i].dep[j])!=nil; j++) {
@@ -595,7 +611,7 @@ install(char *dir)
}
}
vuniq(&files);
-
+
// Convert to absolute paths.
for(i=0; i<files.len; i++) {
if(!isabs(files.p[i])) {