diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2014-05-06 22:43:00 +0200 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2014-05-06 22:43:00 +0200 |
commit | 1dd5293f0c725c1d5f290bbed51b3bec59748d16 (patch) | |
tree | d482aa97641d456c423d4210938b7f986e2ea1e3 /win32/bin/LuaRocks.reg.lua | |
parent | 9f1a6be6c3eb62d70d3788e20604d4b83560faed (diff) | |
download | luarocks-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.lua | 51 |
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 | ||
12 | local f = (arg or {})[1] | ||
13 | if not f then | ||
14 | print("must provide template file on command line") | ||
15 | os.exit(1) | ||
16 | end | ||
17 | |||
18 | -- cleanup filepath, remove all double backslashes | ||
19 | while f:match("\\\\") do | ||
20 | f = f:gsub("\\\\", "\\") | ||
21 | end | ||
22 | |||
23 | -- extract path and name from argument | ||
24 | local p = "" | ||
25 | local ni = f | ||
26 | for 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 | ||
32 | end | ||
33 | |||
34 | -- create output name | ||
35 | local no = ni:gsub("%.template","") | ||
36 | |||
37 | -- create path substitute; escape backslash by doubles | ||
38 | local ps = p:gsub("\\", "\\\\") | ||
39 | |||
40 | -- read template | ||
41 | local fh = io.open(f) | ||
42 | local content = fh:read("*a") | ||
43 | fh:close() | ||
44 | |||
45 | -- fill template | ||
46 | content = content:gsub("%<LUAROCKSPATH%>", ps) | ||
47 | |||
48 | -- write destination file | ||
49 | fh = io.open(p..no, "w+") | ||
50 | fh:write(content) | ||
51 | fh:close() | ||