aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2013-11-11 14:29:13 +0100
committerThijs Schreijer <thijs@thijsschreijer.nl>2013-11-11 14:29:13 +0100
commit42999790aa9737d82c1fcda4f68d4f095a64389d (patch)
tree4c1a54fbe3d09afa9238fcb2defb679f9919bc29
parent7bd1a6549d1f2118838e0ee513f163d025af2a20 (diff)
downloadluarocks-42999790aa9737d82c1fcda4f68d4f095a64389d.tar.gz
luarocks-42999790aa9737d82c1fcda4f68d4f095a64389d.tar.bz2
luarocks-42999790aa9737d82c1fcda4f68d4f095a64389d.zip
fixed issue with double quoted arguments
-rw-r--r--install.bat28
1 files changed, 21 insertions, 7 deletions
diff --git a/install.bat b/install.bat
index 2d102f7c..3c7d1093 100644
--- a/install.bat
+++ b/install.bat
@@ -372,20 +372,34 @@ local with_arg = { -- options followed by an argument, others are flags
372 ["/BIN"] = true, 372 ["/BIN"] = true,
373 ["/LIB"] = true, 373 ["/LIB"] = true,
374} 374}
375-- reconstruct argument values with spaces 375-- reconstruct argument values with spaces and double quotes
376if #arg > 1 then 376-- this will be damaged by the batch construction at the start of this file
377 for i = #arg - 1, 1, -1 do 377if #arg > 0 then
378 if (arg[i]:sub(1,1) ~= "/") and (arg[i+1]:sub(1,1) ~= "/") then 378 farg = table.concat(arg, " ") .. " "
379 arg[i] = arg[i].." "..arg[i+1] 379 arg = {}
380 table.remove(arg, i+1) 380 farg = farg:gsub('%"', "")
381 local i = 0
382 while #farg>0 do
383 i = i + 1
384 if (farg:sub(1,1) ~= "/") and ((arg[i-1] or ""):sub(1,1) ~= "/") then
385 i = i - 1 -- continued previous arg
386 if i == 0 then i = 1 end
387 end
388 if arg[i] then
389 arg[i] = arg[i] .. " "
390 else
391 arg[i] = ""
381 end 392 end
393 local v,r = farg:match("^(.-)%s(.*)$")
394 arg[i], farg = arg[i]..v, r
395 while farg:sub(1,1) == " " do farg = farg:sub(2,-1) end -- remove prefix spaces
382 end 396 end
383end 397end
384 398
385local i = 1 399local i = 1
386while i <= #arg do 400while i <= #arg do
387 local opt = arg[i] 401 local opt = arg[i]
388 if with_arg[opt] then 402 if with_arg[opt:upper()] then
389 local value = arg[i + 1] 403 local value = arg[i + 1]
390 if not value then 404 if not value then
391 die("Missing value for option "..opt) 405 die("Missing value for option "..opt)