From e1f8f6697e3ce082e338b70b2ff77af395ba1c00 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sat, 23 Sep 2017 19:16:34 +1000 Subject: [PATCH] cp may work properly on large files now, previous method was a horrid hack --- modules/lib/fs.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/lib/fs.lua b/modules/lib/fs.lua index d5cd39e..e8ddd0b 100644 --- a/modules/lib/fs.lua +++ b/modules/lib/fs.lua @@ -237,7 +237,12 @@ function fs.cp(s,d) local df = fs.open(d,"wb") local sf = fs.open(s,"rb") if df and sf then - fs.write(df,fs.readall(sf)) + local c = "" + while true do + c=fs.read(sf,2048) + if not c then break end + fs.write(df,c) + end fs.close(df) fs.close(sf) return true