diff options
| -rw-r--r-- | src/luarocks/fetch.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/fetch.tl | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index bcee6f23..50363cc0 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -49,7 +49,10 @@ function fetch.fetch_caching(url, mirroring) | |||
| 49 | local repo_url, filename = url:match("^(.*)/([^/]+)$") | 49 | local repo_url, filename = url:match("^(.*)/([^/]+)$") |
| 50 | local name = repo_url:gsub("[/:]", "_") | 50 | local name = repo_url:gsub("[/:]", "_") |
| 51 | local cache_dir = dir.path(cfg.local_cache, name) | 51 | local cache_dir = dir.path(cfg.local_cache, name) |
| 52 | local ok = fs.make_dir(cache_dir) | 52 | local ok = fs.exists(cfg.local_cache) |
| 53 | if ok then | ||
| 54 | ok = fs.make_dir(cache_dir) | ||
| 55 | end | ||
| 53 | 56 | ||
| 54 | local cachefile = dir.path(cache_dir, filename) | 57 | local cachefile = dir.path(cache_dir, filename) |
| 55 | local checkfile = cachefile .. ".check" | 58 | local checkfile = cachefile .. ".check" |
diff --git a/src/luarocks/fetch.tl b/src/luarocks/fetch.tl index 2f81ac0c..75f0a157 100644 --- a/src/luarocks/fetch.tl +++ b/src/luarocks/fetch.tl | |||
| @@ -49,12 +49,15 @@ function fetch.fetch_caching(url: string, mirroring?: string): string, string, s | |||
| 49 | local repo_url, filename = url:match("^(.*)/([^/]+)$") | 49 | local repo_url, filename = url:match("^(.*)/([^/]+)$") |
| 50 | local name = repo_url:gsub("[/:]","_") | 50 | local name = repo_url:gsub("[/:]","_") |
| 51 | local cache_dir = dir.path(cfg.local_cache, name) | 51 | local cache_dir = dir.path(cfg.local_cache, name) |
| 52 | local ok = fs.make_dir(cache_dir) | 52 | local ok = fs.exists(cfg.local_cache) |
| 53 | if ok then | ||
| 54 | ok = fs.make_dir(cache_dir) | ||
| 55 | end | ||
| 53 | 56 | ||
| 54 | local cachefile = dir.path(cache_dir, filename) | 57 | local cachefile = dir.path(cache_dir, filename) |
| 55 | local checkfile = cachefile .. ".check" | 58 | local checkfile = cachefile .. ".check" |
| 56 | 59 | ||
| 57 | if (fs.file_age(checkfile) < 10 or | 60 | if (fs.exists(checkfile) and fs.file_age(checkfile) < 10 or |
| 58 | cfg.aggressive_cache and (not name:match("^manifest"))) and fs.exists(cachefile) | 61 | cfg.aggressive_cache and (not name:match("^manifest"))) and fs.exists(cachefile) |
| 59 | then | 62 | then |
| 60 | return cachefile, nil, nil, true | 63 | return cachefile, nil, nil, true |
| @@ -75,6 +78,8 @@ function fetch.fetch_caching(url: string, mirroring?: string): string, string, s | |||
| 75 | if not ok then | 78 | if not ok then |
| 76 | return nil, "Failed creating temporary cache directory "..cache_dir | 79 | return nil, "Failed creating temporary cache directory "..cache_dir |
| 77 | end | 80 | end |
| 81 | cachefile = dir.path(cache_dir, filename) | ||
| 82 | checkfile = cachefile .. ".check" | ||
| 78 | lock = fs.lock_access(cache_dir) | 83 | lock = fs.lock_access(cache_dir) |
| 79 | end | 84 | end |
| 80 | 85 | ||
