26 lines
395 B
Go
26 lines
395 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
func ByteSliceToString(b []byte) string {
|
|
var ret string
|
|
|
|
for i := 0; i < len(b); i++ {
|
|
s := fmt.Sprintf("%02x", b[i])
|
|
ret += string(s)
|
|
}
|
|
return ret
|
|
}
|
|
func GetCurrentDirectory() string {
|
|
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
|
if err != nil {
|
|
return "./"
|
|
}
|
|
return strings.Replace(dir, "\\", "/", -1)
|
|
}
|