aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2010-12-21 11:19:15 -0200
committerHisham Muhammad <hisham@gobolinux.org>2010-12-21 11:19:15 -0200
commita0be4736ef870adc118a7d04931a9edaf7c2eda7 (patch)
treea938c4f8df28cf77d0cd8249126c68c597a8f015
parentb2f4e356b6ede8860b22501aa4ee2578ec9a1a03 (diff)
downloadluarocks-a0be4736ef870adc118a7d04931a9edaf7c2eda7.tar.gz
luarocks-a0be4736ef870adc118a7d04931a9edaf7c2eda7.tar.bz2
luarocks-a0be4736ef870adc118a7d04931a9edaf7c2eda7.zip
Fix error message on unsupported protocols
-rw-r--r--src/luarocks/fs/lua.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 5b3efd94..79baa07f 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -431,19 +431,19 @@ function unzip(zipfile)
431 local files = zipfile:files() 431 local files = zipfile:files()
432 local file = files() 432 local file = files()
433 repeat 433 repeat
434 if file.filename:sub(#file.filename) == "/" then 434 if file.filename:sub(#file.filename) == "/" then
435 fs.make_dir(dir.path(fs.current_dir(), file.filename)) 435 fs.make_dir(dir.path(fs.current_dir(), file.filename))
436 else 436 else
437 local rf, err = zipfile:open(file.filename) 437 local rf, err = zipfile:open(file.filename)
438 if not rf then zipfile:close(); return nil, err end 438 if not rf then zipfile:close(); return nil, err end
439 local contents = rf:read("*a") 439 local contents = rf:read("*a")
440 rf:close() 440 rf:close()
441 local wf, err = io.open(dir.path(fs.current_dir(), file.filename), "wb") 441 local wf, err = io.open(dir.path(fs.current_dir(), file.filename), "wb")
442 if not wf then zipfile:close(); return nil, err end 442 if not wf then zipfile:close(); return nil, err end
443 wf:write(contents) 443 wf:write(contents)
444 wf:close() 444 wf:close()
445 end 445 end
446 file = files() 446 file = files()
447 until not file 447 until not file
448 zipfile:close() 448 zipfile:close()
449 return true 449 return true
@@ -494,6 +494,8 @@ function download(url, filename)
494 end 494 end
495 elseif util.starts_with(url, "ftp:") then 495 elseif util.starts_with(url, "ftp:") then
496 content, err = ftp.get(url) 496 content, err = ftp.get(url)
497 else
498 err = "Unsupported protocol in URL: "..url
497 end 499 end
498 if not content then 500 if not content then
499 return false, "Failed downloading: " .. err 501 return false, "Failed downloading: " .. err