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