summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/fs.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-24 15:39:32 +0000
committerSteven Barth <steven@midlink.org>2008-03-24 15:39:32 +0000
commit06a385370c630a2e57412caf3a67ac77cc0e1b49 (patch)
treec93440d4623d17fa4094e9abe253b910edabdb5c /src/ffluci/fs.lua
parentef01ff75db17f23a90757cf473778cfefe1ad120 (diff)
* CBI: updates
* UCI: Introduced Session class, supporting different change file paths * util: introduced sessionid() function * general: Changed several error messages to OS native ones
Diffstat (limited to 'src/ffluci/fs.lua')
-rw-r--r--src/ffluci/fs.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ffluci/fs.lua b/src/ffluci/fs.lua
index fb9a9c1c9..fdea1b51e 100644
--- a/src/ffluci/fs.lua
+++ b/src/ffluci/fs.lua
@@ -37,10 +37,10 @@ end
-- Returns the content of file
function readfile(filename)
- local fp = io.open(filename)
+ local fp, err = io.open(filename)
if fp == nil then
- error("Unable to open file for reading: " .. filename)
+ error(err)
end
local data = fp:read("*a")
@@ -50,12 +50,12 @@ end
-- Returns the content of file as array of lines
function readfilel(filename)
- local fp = io.open(filename)
+ local fp, err = io.open(filename)
local line = ""
local data = {}
if fp == nil then
- error("Unable to open file for reading: " .. filename)
+ error(err)
end
while true do
@@ -70,9 +70,9 @@ end
-- Writes given data to a file
function writefile(filename, data)
- local fp = io.open(filename, "w")
+ local fp, err = io.open(filename, "w")
if fp == nil then
- error("Unable to open file for writing: " .. filename)
+ error(err)
end
fp:write(data)
fp:close()
@@ -97,4 +97,9 @@ function dir(path)
end
end
return e
+end
+
+-- Alias for lfs.mkdir
+function mkdir(...)
+ return lfs.mkdir(...)
end \ No newline at end of file