maj du currentdir
This commit is contained in:
@@ -151,3 +151,18 @@ func ColorizeSubStrRed(s string, sub string) string {
|
||||
func DoubleBackSlash(s string) string {
|
||||
return strings.Replace(s, "\\", "\\\\", -1)
|
||||
}
|
||||
|
||||
// function that return the program current directory
|
||||
func GetProgramDir() string {
|
||||
|
||||
// get the absolut path of the executable
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// get the directory of the executable
|
||||
exPath := filepath.Dir(ex)
|
||||
|
||||
return exPath
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user