From 9c48355ef7f5ed44cb1a6530c36f74732025520d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 24 May 2018 16:43:54 -0300 Subject: init: only create wrappers if they don't already exist --- src/luarocks/cmd/init.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua index e037fb55..5c0116ce 100644 --- a/src/luarocks/cmd/init.lua +++ b/src/luarocks/cmd/init.lua @@ -77,14 +77,20 @@ function init.command(flags, name, version) fs.make_dir("lua_modules/lib/luarocks/rocks-" .. cfg.lua_version) local tree = dir.path(pwd, "lua_modules") - util.printout("Preparing ./luarocks ...") + local ext = cfg.wrapper_suffix - fs.wrap_script(arg[0], "luarocks", nil, nil, "--project-tree", tree) - - util.printout("Preparing ./lua ...") + local luarocks_wrapper = "./luarocks" .. ext + if not fs.exists(luarocks_wrapper) then + util.printout("Preparing " .. luarocks_wrapper .. " ...") + fs.wrap_script(arg[0], "luarocks", nil, nil, "--project-tree", tree) + end - path.use_tree(tree) - fs.wrap_script(nil, "lua") + local lua_wrapper = "./lua" .. ext + if not fs.exists(lua_wrapper) then + util.printout("Preparing " .. lua_wrapper .. " ...") + path.use_tree(tree) + fs.wrap_script(nil, "lua") + end return true end -- cgit v1.2.3-55-g6feb