Make debug dir specific to username to ease off multi user logins
This commit is contained in:
parent
e7ebb9745d
commit
2a242c8f26
@ -22,6 +22,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
@ -34,7 +35,17 @@ var RecoverPrettyPanic bool
|
|||||||
var DeadlockDetection bool
|
var DeadlockDetection bool
|
||||||
var WriteLogs bool
|
var WriteLogs bool
|
||||||
var OnRecover func()
|
var OnRecover func()
|
||||||
var LogDirectory = filepath.Join(os.TempDir(), "gomuks")
|
var LogDirectory = filepath.Join(os.TempDir(), "gomuks-" + getUname())
|
||||||
|
|
||||||
|
func getUname() string {
|
||||||
|
currUser, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return currUser.Username
|
||||||
|
}
|
||||||
|
|
||||||
func Initialize() {
|
func Initialize() {
|
||||||
err := os.MkdirAll(LogDirectory, 0750)
|
err := os.MkdirAll(LogDirectory, 0750)
|
||||||
|
Loading…
Reference in New Issue
Block a user