From faac6621a5b15e74fa66ac3bdb7d594f7f5e2f08 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sat, 23 Sep 2017 11:22:33 +1000 Subject: [PATCH] made fs.cp fail if either handle fails to open. ??? --- modules/lib/fs.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/lib/fs.lua b/modules/lib/fs.lua index 23500dc..7618639 100644 --- a/modules/lib/fs.lua +++ b/modules/lib/fs.lua @@ -236,9 +236,13 @@ end function fs.cp(s,d) local df = fs.open(d,"wb") local sf = fs.open(s,"rb") - fs.write(df,fs.readall(sf)) - fs.close(df) - fs.close(sf) + if df and sf then + fs.write(df,fs.readall(sf)) + fs.close(df) + fs.close(sf) + return true + end + return false end function fs.mv(s,d) fs.cp(s,d)