From 295c2940873e94c33e5f556284c7e9f3a1d296f5 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 4 Oct 2011 17:22:57 -0300 Subject: Verify that file actually exists when using the 'file' protocol. Closes #47. --- src/luarocks/fetch.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index c5983797..3f96e523 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua @@ -59,7 +59,11 @@ function fetch_url_at_temp_dir(url, tmpname, filename) local protocol, pathname = dir.split_url(url) if protocol == "file" then - return pathname, dir.dir_name(fs.absolute_name(pathname)) + if fs.exists(pathname) then + return pathname, dir.dir_name(fs.absolute_name(pathname)) + else + return nil, "File not found: "..pathname + end else local temp_dir = fs.make_temp_dir(tmpname) if not temp_dir then -- cgit v1.2.3-55-g6feb