aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fs/unix.lua2
-rw-r--r--src/luarocks/fs/win32.lua3
-rw-r--r--src/luarocks/util.lua4
3 files changed, 9 insertions, 0 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index 5b9a11b5..e154ef45 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -54,6 +54,8 @@ function wrap_script(file, dest, name, version)
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 lpath, lcpath = cfg.package_paths()
57 lpath = util.escape_doublebrackets(lpath)
58 lcpath = util.escape_doublebrackets(lcpath)
57 local wrapper = io.open(wrapname, "w") 59 local wrapper = io.open(wrapname, "w")
58 if not wrapper then 60 if not wrapper then
59 return nil, "Could not open "..wrapname.." for writing." 61 return nil, "Could not open "..wrapname.." for writing."
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index 8f14239d..ba3ba2b3 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -7,6 +7,7 @@ local fs = require("luarocks.fs")
7 7
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9local dir = require("luarocks.dir") 9local dir = require("luarocks.dir")
10local util = require("luarocks.util")
10 11
11--- Annotate command string for quiet execution. 12--- Annotate command string for quiet execution.
12-- @param cmd string: A command-line string. 13-- @param cmd string: A command-line string.
@@ -64,6 +65,8 @@ function wrap_script(file, dest, name, version)
64 local wrapname = fs.is_dir(dest) and dest.."/"..base or dest 65 local wrapname = fs.is_dir(dest) and dest.."/"..base or dest
65 wrapname = wrapname..".bat" 66 wrapname = wrapname..".bat"
66 local lpath, lcpath = cfg.package_paths() 67 local lpath, lcpath = cfg.package_paths()
68 lpath = util.escape_doublebrackets(lpath)
69 lcpath = util.escape_doublebrackets(lcpath)
67 local wrapper = io.open(wrapname, "w") 70 local wrapper = io.open(wrapname, "w")
68 if not wrapper then 71 if not wrapper then
69 return nil, "Could not open "..wrapname.." for writing." 72 return nil, "Could not open "..wrapname.." for writing."
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index e3260359..cfcd2013 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -511,3 +511,7 @@ function array_contains(tbl, value)
511 end 511 end
512 return false 512 return false
513end 513end
514
515function escape_doublebrackets(s)
516 return s:gsub("(([%[%]])%2)","]]..'%1'..[[")
517end \ No newline at end of file