diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index 98abef9..9e24f94 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -2,6 +2,7 @@ package fs import ( "os" + "strings" "github.com/yuin/gopher-lua" ) @@ -26,7 +27,7 @@ var exports = map[string]lua.LGFunction{ func cd(L *lua.LState) int { path := L.ToString(1) - err := os.Chdir(path) + err := os.Chdir(strings.TrimSpace(path)) if err != nil { switch err.(*os.PathError).Err.Error() { case "no such file or directory":