diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2011-03-22 11:02:38 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2011-03-22 11:02:38 -0300 |
commit | c55a52b0eaa753ed00d12b6553777b9ab913101d (patch) | |
tree | 4235546b6cca66b9559b818cc2375817c8ec19bd | |
parent | d4ed388021fda732cb08d95844949457fad9631a (diff) | |
download | luarocks-c55a52b0eaa753ed00d12b6553777b9ab913101d.tar.gz luarocks-c55a52b0eaa753ed00d12b6553777b9ab913101d.tar.bz2 luarocks-c55a52b0eaa753ed00d12b6553777b9ab913101d.zip |
Add support for curl on Windows (untested)
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 17 |
1 files 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) | |||
6 | 6 | ||
7 | local fs = require("luarocks.fs") | 7 | local fs = require("luarocks.fs") |
8 | local cfg = require("luarocks.cfg") | 8 | local cfg = require("luarocks.cfg") |
9 | local dir = require("luarocks.dir") | ||
9 | 10 | ||
10 | local dir_stack = {} | 11 | local dir_stack = {} |
11 | 12 | ||
@@ -253,15 +254,21 @@ end | |||
253 | function download(url, filename) | 254 | function download(url, filename) |
254 | assert(type(url) == "string") | 255 | assert(type(url) == "string") |
255 | assert(type(filename) == "string" or not filename) | 256 | assert(type(filename) == "string" or not filename) |
256 | local wget_cmd = "wget --cache=off --user-agent="..cfg.user_agent.." --quiet --continue " | ||
257 | 257 | ||
258 | if filename then | 258 | if cfg.downloader == "wget" then |
259 | return fs.execute(wget_cmd.." --output-document ", filename, url) | 259 | local wget_cmd = "wget --no-check-certificate --no-cache --user-agent="..cfg.user_agent.." --quiet --continue " |
260 | else | 260 | if filename then |
261 | return fs.execute(wget_cmd, url) | 261 | return fs.execute(wget_cmd.." --output-document ", filename, url) |
262 | else | ||
263 | return fs.execute(wget_cmd, url) | ||
264 | end | ||
265 | elseif cfg.downloader == "curl" then | ||
266 | filename = filename or dir.base_name(url) | ||
267 | return fs.execute_string("curl -L --user-agent "..cfg.user_agent.." "..fs.Q(url).." 2> NUL 1> "..fs.Q(filename)) | ||
262 | end | 268 | end |
263 | end | 269 | end |
264 | 270 | ||
271 | |||
265 | --- Compress files in a .zip archive. | 272 | --- Compress files in a .zip archive. |
266 | -- @param zipfile string: pathname of .zip archive to be created. | 273 | -- @param zipfile string: pathname of .zip archive to be created. |
267 | -- @param ... Filenames to be stored in the archive are given as | 274 | -- @param ... Filenames to be stored in the archive are given as |