diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fs/unix.lua | 3 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua index 92f9abc1..5b9a11b5 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua | |||
@@ -53,12 +53,13 @@ function wrap_script(file, dest, name, version) | |||
53 | 53 | ||
54 | local base = dir.base_name(file) | 54 | local base = dir.base_name(file) |
55 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest | 55 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest |
56 | local lpath, lcpath = cfg.package_paths() | ||
56 | local wrapper = io.open(wrapname, "w") | 57 | local wrapper = io.open(wrapname, "w") |
57 | if not wrapper then | 58 | if not wrapper then |
58 | return nil, "Could not open "..wrapname.." for writing." | 59 | return nil, "Could not open "..wrapname.." for writing." |
59 | end | 60 | end |
60 | wrapper:write("#!/bin/sh\n\n") | 61 | wrapper:write("#!/bin/sh\n\n") |
61 | wrapper:write('exec "'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e \'package.path=[['..package.path..';]]..package.path\' -e \'package.cpath=[['..package.cpath..';]]..package.cpath\' -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" "$@"\n') | 62 | wrapper:write('exec "'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e \'package.path=[['..lpath..';]]..package.path\' -e \'package.cpath=[['..lcpath..';]]..package.cpath\' -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" "$@"\n') |
62 | wrapper:close() | 63 | wrapper:close() |
63 | if fs.chmod(wrapname, "0755") then | 64 | if fs.chmod(wrapname, "0755") then |
64 | return true | 65 | return true |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 6872dc47..8f14239d 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -63,12 +63,13 @@ function wrap_script(file, dest, name, version) | |||
63 | local base = dir.base_name(file) | 63 | local base = dir.base_name(file) |
64 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest | 64 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest |
65 | wrapname = wrapname..".bat" | 65 | wrapname = wrapname..".bat" |
66 | local lpath, lcpath = cfg.package_paths() | ||
66 | local wrapper = io.open(wrapname, "w") | 67 | local wrapper = io.open(wrapname, "w") |
67 | if not wrapper then | 68 | if not wrapper then |
68 | return nil, "Could not open "..wrapname.." for writing." | 69 | return nil, "Could not open "..wrapname.." for writing." |
69 | end | 70 | end |
70 | wrapper:write("@echo off\n") | 71 | wrapper:write("@echo off\n") |
71 | wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e "package.path=[['..package.path..';]]..package.path" -e "package.cpath=[['..package.cpath..';]]..package.cpath" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n') | 72 | wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e "package.path=[['..lpath..';]]..package.path" -e "package.cpath=[['..lcpath..';]]..package.cpath" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n') |
72 | wrapper:close() | 73 | wrapper:close() |
73 | return true | 74 | return true |
74 | end | 75 | end |