use os/user to find user home dir

This commit is contained in:
cuu 2018-12-06 11:43:18 +08:00
parent 947cfae038
commit 757741a362

View File

@ -2,6 +2,7 @@ package LauncherPy
import ( import (
"os/exec" "os/exec"
"os/user"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/cuu/LauncherGoDev/sysgo/UI" "github.com/cuu/LauncherGoDev/sysgo/UI"
@ -20,8 +21,11 @@ func (self *LauncherPyPlugin) Run( main_screen *UI.MainScreen ) {
main_screen.MsgBox.SetText("Rebooting to Launcher") main_screen.MsgBox.SetText("Rebooting to Launcher")
main_screen.MsgBox.Draw() main_screen.MsgBox.Draw()
main_screen.SwapAndShow() main_screen.SwapAndShow()
time.BlockDelay(300) time.BlockDelay(550)
cmd := exec.Command("sed","-i","s/launchergo/launcher/g","~/.bashrc") usr, _ := user.Current()
dir := usr.HomeDir
cmd := exec.Command("sed","-i","s/launchergo/launcher/g",dir+"/.bashrc")
cmd.Run() cmd.Run()
cmd = exec.Command("sudo","reboot") cmd = exec.Command("sudo","reboot")