123456789101112131415161718 |
- package sys
- import (
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- )
- // GetCurrentDir get current process directory
- func GetCurrentDir() string {
- file, _ := exec.LookPath(os.Args[0])
- path, _ := filepath.Abs(file)
- idx := strings.LastIndex(path, string(os.PathSeparator))
- return path[:idx]
- }
|