diff options
author | mpeterv <mpeterval@gmail.com> | 2016-01-11 19:21:46 +0300 |
---|---|---|
committer | mpeterv <mpeterval@gmail.com> | 2016-01-11 19:21:46 +0300 |
commit | d725a42e2efd2df34dc21cc1a8bb087241064268 (patch) | |
tree | 7382d7763a7323db83297afbc80c2eb987c0b2fc /src | |
parent | f73a7d9bca18884c7f882e90b5be650ab625a485 (diff) | |
download | luarocks-d725a42e2efd2df34dc21cc1a8bb087241064268.tar.gz luarocks-d725a42e2efd2df34dc21cc1a8bb087241064268.tar.bz2 luarocks-d725a42e2efd2df34dc21cc1a8bb087241064268.zip |
Do not handle cfg.local_cache == nil in luarocks.cache
cfg.local_cache is always set by defaults. Fixes #479.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cache.lua | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/luarocks/cache.lua b/src/luarocks/cache.lua index dbea8405..fb6344d8 100644 --- a/src/luarocks/cache.lua +++ b/src/luarocks/cache.lua | |||
@@ -45,25 +45,12 @@ function cache.split_server_url(server, url, user, password) | |||
45 | user = credentials | 45 | user = credentials |
46 | end | 46 | end |
47 | end | 47 | end |
48 | local local_cache | 48 | local local_cache = cfg.local_cache .. "/" .. server |
49 | if cfg.local_cache then | ||
50 | local_cache = cfg.local_cache .. "/" .. server | ||
51 | end | ||
52 | return local_cache, protocol, server_path, user, password | 49 | return local_cache, protocol, server_path, user, password |
53 | end | 50 | end |
54 | 51 | ||
55 | function cache.refresh_local_cache(server, url, user, password) | 52 | function cache.refresh_local_cache(server, url, user, password) |
56 | local local_cache, protocol, server_path, user, password = cache.split_server_url(server, url, user, password) | 53 | local local_cache, protocol, server_path, user, password = cache.split_server_url(server, url, user, password) |
57 | |||
58 | local ok, err = fs.make_dir(cfg.local_cache) | ||
59 | if not ok then return nil, err end | ||
60 | |||
61 | local tmp_cache = false | ||
62 | if not local_cache then | ||
63 | local err | ||
64 | local_cache, err = fs.make_temp_dir("local_cache") | ||
65 | tmp_cache = true | ||
66 | end | ||
67 | local ok, err = fs.make_dir(local_cache) | 54 | local ok, err = fs.make_dir(local_cache) |
68 | if not ok then | 55 | if not ok then |
69 | return nil, "Failed creating local cache dir: "..err | 56 | return nil, "Failed creating local cache dir: "..err |