From 757741a3625708e0f1efc09c9138c6dd8253956d Mon Sep 17 00:00:00 2001 From: cuu Date: Thu, 6 Dec 2018 11:43:18 +0800 Subject: [PATCH] use os/user to find user home dir --- Menu/GameShell/10_Settings/LauncherPy/plugin_init.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Menu/GameShell/10_Settings/LauncherPy/plugin_init.go b/Menu/GameShell/10_Settings/LauncherPy/plugin_init.go index 91f7f4d..e98fc88 100644 --- a/Menu/GameShell/10_Settings/LauncherPy/plugin_init.go +++ b/Menu/GameShell/10_Settings/LauncherPy/plugin_init.go @@ -2,6 +2,7 @@ package LauncherPy import ( "os/exec" + "os/user" "github.com/cuu/gogame/time" "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.Draw() main_screen.SwapAndShow() - time.BlockDelay(300) - cmd := exec.Command("sed","-i","s/launchergo/launcher/g","~/.bashrc") + time.BlockDelay(550) + usr, _ := user.Current() + dir := usr.HomeDir + + cmd := exec.Command("sed","-i","s/launchergo/launcher/g",dir+"/.bashrc") cmd.Run() cmd = exec.Command("sudo","reboot")