From afcc6fe63a35a10e778dc3e5c89ca660eb5caf40 Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 28 Sep 2021 22:55:08 -0400 Subject: [PATCH] fix: handle error case of target in fs.cd not being a dir (closes #66) --- golibs/fs/fs.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index 59da056..3f7cf44 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -35,6 +35,8 @@ func cd(L *lua.LState) int { switch e := err.(*os.PathError).Err.Error(); e { case "no such file or directory": LuaErr(L, 1) + case "not a directory": + LuaErr(L, 2) default: fmt.Printf("Found unhandled error case: %s\n", e) fmt.Printf("Report this at https://github.com/Rosettea/Hilbish/issues with the title being: \"fs: unhandled error case %s\", and show what caused it.\n", e)