diff options
| author | Hisham <hisham@gobolinux.org> | 2017-02-08 02:41:29 -0200 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2017-09-12 20:28:41 +0300 |
| commit | 186ed708d40945d88e223e0125b706f6d3514385 (patch) | |
| tree | d8305c9cfd5964bf9c4b3e591d42a2c88d6ba2a6 | |
| parent | 4b19e960871d512ffb733f016facda7cb35050d1 (diff) | |
| download | luarocks-186ed708d40945d88e223e0125b706f6d3514385.tar.gz luarocks-186ed708d40945d88e223e0125b706f6d3514385.tar.bz2 luarocks-186ed708d40945d88e223e0125b706f6d3514385.zip | |
Make sure target directory exists when saving API config.
Closes #676.
| -rw-r--r-- | src/luarocks/upload/api.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/luarocks/upload/api.lua b/src/luarocks/upload/api.lua index ba657186..2f0fa815 100644 --- a/src/luarocks/upload/api.lua +++ b/src/luarocks/upload/api.lua | |||
| @@ -3,6 +3,7 @@ local api = {} | |||
| 3 | 3 | ||
| 4 | local cfg = require("luarocks.cfg") | 4 | local cfg = require("luarocks.cfg") |
| 5 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
| 6 | local dir = require("luarocks.dir") | ||
| 6 | local util = require("luarocks.util") | 7 | local util = require("luarocks.util") |
| 7 | local persist = require("luarocks.persist") | 8 | local persist = require("luarocks.persist") |
| 8 | local multipart = require("luarocks.upload.multipart") | 9 | local multipart = require("luarocks.upload.multipart") |
| @@ -36,6 +37,10 @@ function Api:save_config() | |||
| 36 | end | 37 | end |
| 37 | local upload_conf = upload_config_file() | 38 | local upload_conf = upload_config_file() |
| 38 | if not upload_conf then return nil end | 39 | if not upload_conf then return nil end |
| 40 | local ok, err = fs.make_dir(dir.dir_name(upload_conf)) | ||
| 41 | if not ok then | ||
| 42 | return nil, err | ||
| 43 | end | ||
| 39 | persist.save_from_table(upload_conf, self.config) | 44 | persist.save_from_table(upload_conf, self.config) |
| 40 | fs.chmod(upload_conf, "0600") | 45 | fs.chmod(upload_conf, "0600") |
| 41 | end | 46 | end |
