From c55a52b0eaa753ed00d12b6553777b9ab913101d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 22 Mar 2011 11:02:38 -0300 Subject: Add support for curl on Windows (untested) --- src/luarocks/fs/win32/tools.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 9e891fca..dcbd5701 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua @@ -6,6 +6,7 @@ module("luarocks.fs.win32.tools", package.seeall) local fs = require("luarocks.fs") local cfg = require("luarocks.cfg") +local dir = require("luarocks.dir") local dir_stack = {} @@ -253,15 +254,21 @@ end function download(url, filename) assert(type(url) == "string") assert(type(filename) == "string" or not filename) - local wget_cmd = "wget --cache=off --user-agent="..cfg.user_agent.." --quiet --continue " - if filename then - return fs.execute(wget_cmd.." --output-document ", filename, url) - else - return fs.execute(wget_cmd, url) + if cfg.downloader == "wget" then + local wget_cmd = "wget --no-check-certificate --no-cache --user-agent="..cfg.user_agent.." --quiet --continue " + if filename then + return fs.execute(wget_cmd.." --output-document ", filename, url) + else + return fs.execute(wget_cmd, url) + end + elseif cfg.downloader == "curl" then + filename = filename or dir.base_name(url) + return fs.execute_string("curl -L --user-agent "..cfg.user_agent.." "..fs.Q(url).." 2> NUL 1> "..fs.Q(filename)) end end + --- Compress files in a .zip archive. -- @param zipfile string: pathname of .zip archive to be created. -- @param ... Filenames to be stored in the archive are given as -- cgit v1.2.3-55-g6feb