Trapping file ops errors
Posted: Wed Sep 16, 2009 8:44 pm
Hey all....
Fooling around, getting comfortable with newLISP! Currently learning to load modules; trap load errors; checking for existence of files, etc. I cobbled together the following:
So, obviously, I'm first checking whether or not the required file "x", exists. If it does, it will get loaded (I have only a debug msg. at the moment).
Is there a way to absolutely tell that the file did get loaded?
Should "load_mod" be called from within a "catch", e.g.
(catch (load_mod "cgi.lsp")) ?
Fooling around, getting comfortable with newLISP! Currently learning to load modules; trap load errors; checking for existence of files, etc. I cobbled together the following:
Code: Select all
(define (load_mod x)
(if (file? (append (env "NEWLISPDIR") "/modules/" x)) (print "Loading module: " x)
(throw-error "module does not exist")
)
)
Is there a way to absolutely tell that the file did get loaded?
Should "load_mod" be called from within a "catch", e.g.
(catch (load_mod "cgi.lsp")) ?