diff --git a/cmd/phonedata.go b/cmd/phonedata.go index bacc2b6..088848d 100644 --- a/cmd/phonedata.go +++ b/cmd/phonedata.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/xluohome/phonedata" + "github.com/hetao29/phonedata" ) func main() { diff --git a/go.mod b/go.mod index 48db9d0..8c5d9a2 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/xluohome/phonedata +module github.com/hetao29/phonedata -go 1.16 +go 1.21 diff --git a/phonedata.go b/phonedata.go index 7496de9..36e3bbc 100644 --- a/phonedata.go +++ b/phonedata.go @@ -6,8 +6,8 @@ import ( "fmt" "io/ioutil" "os" + "os/exec" "path" - "runtime" ) const ( @@ -53,8 +53,9 @@ var ( func init() { dir := os.Getenv("PHONE_DATA_DIR") if dir == "" { - _, fulleFilename, _, _ := runtime.Caller(0) - dir = path.Dir(fulleFilename) + _file, _ := exec.LookPath(os.Args[0]) + dir, _ = path.Split(_file) + os.Chdir(dir) } var err error content, err = ioutil.ReadFile(path.Join(dir, PHONE_DAT))