mirror of
https://github.com/Hilbis/Hilbish
synced 2025-03-27 17:00:41 +00:00
fix: trim spaces in cd func
This commit is contained in:
parent
204d50d73c
commit
b1f2a36639
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user