mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-06 15:22:08 -04:00
Introduce function utils.AppName()
This commit is contained in:
parent
66d34b4a9f
commit
3061e3d0c5
1 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/utf8string"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
|
@ -179,3 +181,13 @@ func ConvertCamelCase(s string, _case int, sep byte) string {
|
|||
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// AppName returns the name of the executable that started this program (process).
|
||||
func AppName() string {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
exe = os.Args[0]
|
||||
}
|
||||
|
||||
return filepath.Base(exe)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue