mirror of https://github.com/perkeep/perkeep.git
camtool: add env camsrcroot
Change-Id: I701e81ab732d7574a227e8f01ca09ac91c608481
This commit is contained in:
parent
63d4bafd0c
commit
bda047eef7
|
@ -20,6 +20,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"camlistore.org/pkg/cmdmain"
|
||||
"camlistore.org/pkg/osutil"
|
||||
|
@ -29,6 +30,7 @@ var envMap = map[string]func() string{
|
|||
"configdir": osutil.CamliConfigDir,
|
||||
"clientconfig": osutil.UserClientConfigPath,
|
||||
"serverconfig": osutil.UserServerConfigPath,
|
||||
"camsrcroot": srcRoot,
|
||||
}
|
||||
|
||||
type envCmd struct{}
|
||||
|
@ -64,3 +66,12 @@ func (c *envCmd) RunCommand(args []string) error {
|
|||
fmt.Println(fn())
|
||||
return nil
|
||||
}
|
||||
|
||||
func srcRoot() string {
|
||||
for _, dir := range filepath.SplitList(os.Getenv("GOPATH")) {
|
||||
if d := filepath.Join(dir, "src", "camlistore.org"); osutil.DirExists(d) {
|
||||
return d
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue