OC-MultICE/modules/library/fs-util.lua

26 lines
390 B
Lua
Raw Normal View History

function fcopy(i,o)
local f1,f2 = fopen(i,"rb"),fopen(o,"wb")
if f1 and f2 then
local c=fread(f1,math.huge)
repeat
fwrite(f2,c)
c=fread(f1,math.huge)
until c == nil
fclose(f1)
fclose(f2)
return true
end
return false
end
function fmove(i,o)
fcopy(i,o)
frm(i)
end
function fload(i)
2017-06-13 00:28:15 +10:00
local f = fopen(i,"rb")
if f then
2017-06-13 00:28:15 +10:00
return load(freadall(f))
end
return false
end