aboutsummaryrefslogtreecommitdiff
path: root/win32/bin/LuaRocks.reg.lua
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2014-05-06 22:43:00 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2014-05-06 22:43:00 +0200
commit1dd5293f0c725c1d5f290bbed51b3bec59748d16 (patch)
treed482aa97641d456c423d4210938b7f986e2ea1e3 /win32/bin/LuaRocks.reg.lua
parent9f1a6be6c3eb62d70d3788e20604d4b83560faed (diff)
downloadluarocks-1dd5293f0c725c1d5f290bbed51b3bec59748d16.tar.gz
luarocks-1dd5293f0c725c1d5f290bbed51b3bec59748d16.tar.bz2
luarocks-1dd5293f0c725c1d5f290bbed51b3bec59748d16.zip
Reorganized Windows specific files. Now installer can work directly from the repository
Diffstat (limited to 'win32/bin/LuaRocks.reg.lua')
-rw-r--r--win32/bin/LuaRocks.reg.lua51
1 files changed, 0 insertions, 51 deletions
diff --git a/win32/bin/LuaRocks.reg.lua b/win32/bin/LuaRocks.reg.lua
deleted file mode 100644
index 2eb7583a..00000000
--- a/win32/bin/LuaRocks.reg.lua
+++ /dev/null
@@ -1,51 +0,0 @@
1-- Call this file using its full path and the template file as a parameter;
2--
3-- C:\> lua.exe "create_reg_file.lua" "c:\luarocks\2.0\LuaRocks.reg.template"
4--
5-- it will strip the ".template" extension and write to that file the
6-- template contents, where "<LUAROCKSPATH>" will be replaced by the path
7-- to LuaRocks (including the trailing backslash)
8
9
10
11-- Check argument
12local f = (arg or {})[1]
13if not f then
14 print("must provide template file on command line")
15 os.exit(1)
16end
17
18-- cleanup filepath, remove all double backslashes
19while f:match("\\\\") do
20 f = f:gsub("\\\\", "\\")
21end
22
23-- extract path and name from argument
24local p = ""
25local ni = f
26for i = #f, 1, -1 do
27 if f:sub(i,i) == "\\" then
28 ni = f:sub(i+1)
29 p = f:sub(1, i)
30 break
31 end
32end
33
34-- create output name
35local no = ni:gsub("%.template","")
36
37-- create path substitute; escape backslash by doubles
38local ps = p:gsub("\\", "\\\\")
39
40-- read template
41local fh = io.open(f)
42local content = fh:read("*a")
43fh:close()
44
45-- fill template
46content = content:gsub("%<LUAROCKSPATH%>", ps)
47
48-- write destination file
49fh = io.open(p..no, "w+")
50fh:write(content)
51fh:close()