diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2015-07-01 15:13:49 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-07-01 15:13:49 -0300 |
| commit | 634ff0af63a250859863cee25b8ab21e2404a267 (patch) | |
| tree | 193bb89d9ae4921be8c0825d969d93113843bbb8 /src | |
| parent | d00c4e9cd7d0e8209b959710434f8448b4f95915 (diff) | |
| parent | c6e3556c0a883831dde10858b32ce21cacd1bd0e (diff) | |
| download | luarocks-634ff0af63a250859863cee25b8ab21e2404a267.tar.gz luarocks-634ff0af63a250859863cee25b8ab21e2404a267.tar.bz2 luarocks-634ff0af63a250859863cee25b8ab21e2404a267.zip | |
Merge pull request #404 from ignacio/url_to_base_dir
Strip only known extensions
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/fetch.lua | 7 |
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) | |||
| 170 | end | 170 | end |
| 171 | 171 | ||
| 172 | function fetch.url_to_base_dir(url) | 172 | function 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", "")) |
| 175 | end | 180 | end |
| 176 | 181 | ||
| 177 | --- Back-end function that actually loads the local rockspec. | 182 | --- Back-end function that actually loads the local rockspec. |
