mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Move func WuffsRoot to package generate
This commit is contained in:
1 parent
f5c6204f09
commit
d92e90d4f0
4 files changed
+35
-20
No files matched your search
@@ -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")
|
||||
}
|
||||
Reference in new issue
Block a user