summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-01-13 16:01:06 +0000
committerTed Trask <ttrask01@yahoo.com>2009-01-13 16:01:06 +0000
commite97b155a36a9fe474dd3152e45e5dbfc57d1993b (patch)
tree37ae4ac677a46e0f84c4bf2ed87955821e993d5d
parent0f63b455eba2f4ad95ea58f938953e1ec9031625 (diff)
downloadacf-alpine-conf-e97b155a36a9fe474dd3152e45e5dbfc57d1993b.tar.bz2
acf-alpine-conf-e97b155a36a9fe474dd3152e45e5dbfc57d1993b.tar.xz
Modified fs.lua to survive nil parameters. Added create_directory and used within create_file and write_file. Reviewed each read_file call to make sure handles nil return value.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@1677 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--lbu-model.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lbu-model.lua b/lbu-model.lua
index 1b9cd79..f3cd3b6 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -180,7 +180,7 @@ end
local was_mounted
local mnt
local function mount()
- local configopts = format.parse_ini_file(fs.read_file(configfile), "") or {}
+ local configopts = format.parse_ini_file(fs.read_file(configfile) or "", "") or {}
mnt = "/media/"..configopts.LBU_MEDIA
local f = io.popen("grep "..mnt.." /proc/mounts")
local cmdresult = f:read("*a")
@@ -243,7 +243,7 @@ function getconfig (configcontents)
if configcontents then
configopts = format.parse_ini_file(configcontents, "") or {}
elseif (fs.is_file(configfile)) then
- configopts = format.parse_ini_file(fs.read_file(configfile), "") or {}
+ configopts = format.parse_ini_file(fs.read_file(configfile) or "", "") or {}
end
config["LBU_MEDIA"] = cfe({
value=configopts.LBU_MEDIA or "",
@@ -457,7 +457,7 @@ function getpackage()
local package = cfe({ type="raw", label="error", option="application/x-gzip" })
for name in fs.find(".*tar%.gz", tmp) do
package.label = basename(name)
- package.value = fs.read_file(name)
+ package.value = fs.read_file(name) or ""
break
end