libs/uvl: convert uvlc to nixio.fs api, fix error condition when no schema is found
This commit is contained in:
parent
60aaab2ede
commit
281c92b1d6
1 changed files with 5 additions and 4 deletions
|
@ -1,21 +1,22 @@
|
||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
|
||||||
if arg[1] then
|
if arg[1] then
|
||||||
require("luci.util")
|
require("luci.util")
|
||||||
require("luci.uvl")
|
require("luci.uvl")
|
||||||
require("luci.fs")
|
require("nixio.fs")
|
||||||
|
|
||||||
local uvl = luci.uvl.UVL()
|
local uvl = luci.uvl.UVL()
|
||||||
local scheme, err = uvl:get_scheme( arg[1] )
|
local scheme, err = uvl:get_scheme( arg[1] )
|
||||||
|
|
||||||
if scheme then
|
if scheme then
|
||||||
luci.fs.writefile(
|
nixio.fs.writefile(
|
||||||
"%s/bytecode/%s.lua" %{ uvl.schemedir, arg[1] },
|
"%s/bytecode/%s.lua" %{ uvl.schemedir, arg[1] },
|
||||||
luci.util.get_bytecode(scheme)
|
luci.util.get_bytecode(scheme)
|
||||||
)
|
)
|
||||||
else
|
elseif err then
|
||||||
print("Error:", err:string())
|
print("Error:", err:string())
|
||||||
|
else
|
||||||
|
print("Error: Can not find scheme:", arg[1])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print( "Usage: uvlc <scheme>" )
|
print( "Usage: uvlc <scheme>" )
|
||||||
|
|
Loading…
Reference in a new issue