handle user variables on all platforms

This commit is contained in:
Gokcehan committed 2017-08-06 11:05:46 +03:00
1 parent ae4a29e550
commit cb577a4c3a
7 files changed
+80 -49

No files matched your search

+26 -3
View File
@@ -4,12 +4,35 @@ import (
"log"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"
)
var gDefaultShell = "cmd"
var gDefaultSocketProt = "tcp"
var gDefaultSocketPath = ":12345"
var (
gDefaultShell = "cmd"
gDefaultSocketProt = "tcp"
gDefaultSocketPath = ":12345"
)
var (
gUser *user.User
gConfigPath string
)
func init() {
var err error
gUser, err = user.Current()
if err != nil {
log.Printf("user: %s", err)
}
// remove domain prefix
gUser.Username = strings.Split(gUser.Username, `\`)[1]
gConfigPath = filepath.Join(gUser.HomeDir, "AppData", "Local", "lf", "lfrc")
}
func pauseCommand() *exec.Cmd {
return exec.Command("cmd", "/c", "pause")