Initial commit.

This commit is contained in:
AJ Kelly
2010-01-26 21:00:30 -06:00
parent 80057f53cd
commit 3e51544930
4074 changed files with 588945 additions and 543956 deletions
+32
View File
@@ -0,0 +1,32 @@
-- fileutils: quick and dirty, not user prefs oriented file io
File = {
Write = function(path,buf)
local f = RageFileUtil.CreateRageFile()
if f:Open(path, 2) then
f:Write( tostring(buf) )
f:destroy()
return true
else
Trace( "[FileUtils] Error writing to ".. path ..": ".. f:GetError() );
f:ClearError();
f:destroy()
return false
end
end,
Read = function(path)
local f = RageFileUtil.CreateRageFile()
local ret = ""
if f:Open(path, 1) then
ret = tostring( f:Read() )
f:destroy()
return ret
else
Trace( "[FileUtils] Error reading from ".. path ..": ".. f:GetError() );
f:ClearError();
f:destroy()
return nil
end
end
};
-- this code if public domain and/or has no copyright, depending on your
-- country's laws. I wish for you to use this code freely, without restriction.