From 7326cb77c645127cafa2f3ab43f2153ed47dcb27 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:58:12 -0400 Subject: [PATCH] fix: display error to user if dir does not exist --- preload.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/preload.lua b/preload.lua index 76f48eb..d129412 100644 --- a/preload.lua +++ b/preload.lua @@ -3,9 +3,15 @@ local fs = require 'fs' local commander = require 'commander' +local bait = require 'bait' commander.register('cd', function (path) if #path == 1 then - fs.cd(path[1]) + local ok, err = pcall(function() fs.cd(path[1]) end) + if not ok then + if err == 1 then + print("directory does not exist") + end + end end end)