Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2012-10-24 19:40:17 +0400
committerOliver Schneider <oliver@assarbad.net>2012-10-24 19:40:17 +0400
commitbee3c371de0e73316927a4bb7c96e6c6aec705b8 (patch)
tree4a29094e6ccf5c5975244186093a0d683ab701b3 /sandbox
parent790faecabae0e25e791bbfaf41c3b76947969d4b (diff)
- Adding a few Lua functions from Premake4
- winreg.lua added/moved as implementation of two composite operations (copykey, movekey)
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/luaconf/lua_conf.lua42
1 files changed, 0 insertions, 42 deletions
diff --git a/sandbox/luaconf/lua_conf.lua b/sandbox/luaconf/lua_conf.lua
deleted file mode 100644
index f62f55f..0000000
--- a/sandbox/luaconf/lua_conf.lua
+++ /dev/null
@@ -1,42 +0,0 @@
-local winreg = require "winreg"
-
-function winreg.copykey(src, dst, remove_dst_on_fail)
- hksrc = winreg.openkey(src, "r")
- if not hksrc then
- return nil, string.format("Source key (%s) could not be opened", src)
- end
- hkdst = winreg.openkey(dst) or winreg.createkey(dst)
- if not hkdst then
- if remove_dst_on_fail then hkdst:deletekey() end
- return nil, string.format("Destination key (%s) could not be opened/created", dst)
- end
- for vname, vtype in hksrc:enumvalue() do
- if not hkdst:setvalue(vname, hksrc:getvalue(vname), vtype) then
- if remove_dst_on_fail then hkdst:deletekey() end
- return nil, string.format("Destination key (%s) could not be opened", dst)
- end
- end
- for kname in hksrc:enumkey() do
- ret, err = winreg.copykey(src .. [[\]] .. kname, dst .. [[\]] .. kname)
- if not ret then
- return ret, err
- end
- end
- return true
-end
-
-function winreg.movekey(src, dst, remove_dst_on_fail)
- ret, err = winreg.copykey(src, dst, remove_dst_on_fail)
- if not ret then
- return ret, err
- end
- hksrc = winreg.openkey(src)
- if not hksrc then
- return nil, string.format("Could not open %s for removal", src)
- else
- if not hksrc:deletekey() then
- return nil, string.format("Could not remove %s", src)
- end
- end
- return true
-end