File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 "os"
1010 "path/filepath"
1111 "reflect"
12- "runtime"
1312 "strings"
1413
14+ "github.com/hi20160616/gears"
1515 "github.com/liuzl/da"
1616)
1717
@@ -23,14 +23,22 @@ var (
2323)
2424
2525func defaultDir () string {
26- if runtime .GOOS == "windows" {
27- return `C:\gocc\`
28- }
2926 if goPath , ok := os .LookupEnv ("GOPATH" ); ok {
30- return goPath + "/src/github.com/liuzl/gocc/"
31- } else {
32- return `/usr/local/share/gocc/`
27+ //judge whether the path exists
28+ //goPath + "/src/github.com/liuzl/gocc/" or "/pkg/mod/github.com/liuzl/gocc/"
29+ //if those path do not exist, return current work dir
30+ p := goPath + "/src/github.com/liuzl/gocc/"
31+ if gears .Exists (p ) {
32+ return p
33+ } else if p = goPath + "/pkg/mod/github.com/liuzl/gocc?/" ; gears .Exists (p ) {
34+ return p
35+ }
36+ }
37+ path , err := os .Getwd ()
38+ if err != nil {
39+ return ""
3340 }
41+ return path + "/internal/gocc/"
3442}
3543
3644// Group holds a sequence of dicts
You can’t perform that action at this time.
0 commit comments