package utils import ( "os" "path/filepath" ) func GetExecDir() string { if os.Getenv("GoHTTPD_Home") != "" { return os.Getenv("GoHTTPD_Home") } execPath, err := os.Executable() if err != nil { panic(err) } rpath, err := filepath.EvalSymlinks(execPath) if err != nil { panic(err) } rpath, _ = filepath.Abs(rpath) return filepath.Dir(rpath) } func NormalizePath(path string) string { // return filepath.ToSlash(filepath.Clean(path)) p := filepath.ToSlash(path) if filepath.IsAbs(p) { return p } else { return filepath.Join(GetExecDir(), p) } }