aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgnacio Burgueño <ignaciob@inconcertcc.com>2015-06-30 12:33:36 -0300
committerIgnacio Burgueño <ignaciob@inconcertcc.com>2015-06-30 12:33:36 -0300
commitc6e3556c0a883831dde10858b32ce21cacd1bd0e (patch)
tree249fc65fc70a709e5fb0223eb62f699f56f7f3a0 /src
parent066e1c6bd90d2e0e4fcdbc116bd857c62779b4cd (diff)
downloadluarocks-c6e3556c0a883831dde10858b32ce21cacd1bd0e.tar.gz
luarocks-c6e3556c0a883831dde10858b32ce21cacd1bd0e.tar.bz2
luarocks-c6e3556c0a883831dde10858b32ce21cacd1bd0e.zip
Strip known extensions
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fetch.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index 686aadcd..e92aeddf 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -170,8 +170,13 @@ function fetch.fetch_and_unpack_rock(rock_file, dest)
170end 170end
171 171
172function fetch.url_to_base_dir(url) 172function fetch.url_to_base_dir(url)
173 -- for extensions like foo.tar.gz, "gz" is stripped first
174 local known_exts = {}
175 for _, ext in ipairs{"zip", "git", "tgz", "tar", "gz", "bz2"} do
176 known_exts[ext] = ""
177 end
173 local base = dir.base_name(url) 178 local base = dir.base_name(url)
174 return base:gsub("%.[^.]*$", ""):gsub("%.tar$", "") 179 return (base:gsub("%.([^.]*)$", known_exts):gsub("%.tar", ""))
175end 180end
176 181
177--- Back-end function that actually loads the local rockspec. 182--- Back-end function that actually loads the local rockspec.