maj du currentdir

This commit is contained in:
2023-06-30 14:17:21 -04:00
parent 97466a8f71
commit 7d4d6cb0e7
6 changed files with 27 additions and 7 deletions
+15
View File
@@ -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
}