libs/uvl: convert uvlc to nixio.fs api, fix error condition when no schema is found
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 23 Jul 2009 03:23:48 +0000 (03:23 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 23 Jul 2009 03:23:48 +0000 (03:23 +0000)
libs/uvl/root/usr/bin/uvlc

index c07cc54ccdeb39f22116ec48153039d0d978bf4f..caaeb2af6f3e5953f25efce049daaf4d47fbfb64 100755 (executable)
@@ -1,21 +1,22 @@
 #!/usr/bin/lua
 
-
 if arg[1] then
        require("luci.util")
        require("luci.uvl")
-       require("luci.fs")
+       require("nixio.fs")
 
        local uvl = luci.uvl.UVL()
        local scheme, err = uvl:get_scheme( arg[1] )
 
        if scheme then
-               luci.fs.writefile(
+               nixio.fs.writefile(
                        "%s/bytecode/%s.lua" %{ uvl.schemedir, arg[1] },
                        luci.util.get_bytecode(scheme)
                )
-       else
+       elseif err then
                print("Error:", err:string())
+       else
+               print("Error: Can not find scheme:", arg[1])
        end
 else
        print( "Usage: uvlc <scheme>" )