fix: make appendPath expand ~ to home dir

pull/46/head
sammy 2021-05-01 15:35:43 -04:00
parent 9934ba417f
commit c43aab6a60
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 4 additions and 1 deletions

5
lua.go
View File

@ -2,10 +2,12 @@ package main
import ( import (
"fmt" "fmt"
"os"
"strings"
"hilbish/golibs/bait" "hilbish/golibs/bait"
"hilbish/golibs/commander" "hilbish/golibs/commander"
"hilbish/golibs/fs" "hilbish/golibs/fs"
"os"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )
@ -118,6 +120,7 @@ func hshalias(L *lua.LState) int {
func hshappendPath(L *lua.LState) int { func hshappendPath(L *lua.LState) int {
path := L.CheckString(1) path := L.CheckString(1)
path = strings.Replace(path, "~", curuser.HomeDir, 1)
os.Setenv("PATH", os.Getenv("PATH") + ":" + path) os.Setenv("PATH", os.Getenv("PATH") + ":" + path)