Move func WuffsRoot to package generate

This commit is contained in:
Nigel Tao committed 2017-12-28 11:02:49 +11:00
1 parent f5c6204f09
commit d92e90d4f0
4 files changed
+35 -20

No files matched your search

-15
View File
@@ -19,11 +19,7 @@
package commonflags
import (
"errors"
"go/build"
"os"
"path"
"path/filepath"
)
const (
@@ -66,14 +62,3 @@ func IsAlphaNumericIsh(s string) bool {
func IsValidUsePath(s string) bool {
return s == path.Clean(s) && s != "" && s[0] != '.' && s[0] != '/'
}
func WuffsRoot() (string, error) {
// TODO: look for a WUFFSROOT environment variable?
for _, p := range filepath.SplitList(build.Default.GOPATH) {
p = filepath.Join(p, "src", "github.com", "google", "wuffs")
if o, err := os.Stat(p); err == nil && o.IsDir() {
return p, nil
}
}
return "", errors.New("could not find Wuffs root directory")
}