forked from dan/liminix
improve file-exists? function
This commit is contained in:
parent
80639a7256
commit
a65bb9d585
@ -37,10 +37,10 @@
|
|||||||
|
|
||||||
|
|
||||||
(fn file-exists? [name]
|
(fn file-exists? [name]
|
||||||
(let [f (io.open name :r)]
|
(match (io.open name :r)
|
||||||
(match f
|
f (do (f:close) true)
|
||||||
non-nil (or (f:close) true)
|
_ false))
|
||||||
(nil err) false)))
|
|
||||||
|
|
||||||
(fn read-line [name]
|
(fn read-line [name]
|
||||||
(with-open [f (assert (io.open name :r) (.. "can't open file " name))]
|
(with-open [f (assert (io.open name :r) (.. "can't open file " name))]
|
||||||
|
Loading…
Reference in New Issue
Block a user