diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-04-17 11:22:49 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-04-17 11:23:47 -0300 |
commit | 5641b64f3b051254ff8c9010f312bf35c750810e (patch) | |
tree | a14d3e6cc4449e8ba759e8c17c315a96c129e7f5 /src | |
parent | 0171e22f3ddaef5b694409aba3e0f1c8def41dba (diff) | |
download | luarocks-5641b64f3b051254ff8c9010f312bf35c750810e.tar.gz luarocks-5641b64f3b051254ff8c9010f312bf35c750810e.tar.bz2 luarocks-5641b64f3b051254ff8c9010f312bf35c750810e.zip |
repos: prevent fs.move from failing
Prevent fs.move from failing with
```
File already exists: /usr/local/share/lua/5.1/luasec_0_6_2-ssl.lua
```
when overwriting a stale file. This should have already been handled,
but in case the manifest is out of sync for some reason this should
make the behavior more smooth.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/repos.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index eaec87b8..0058d928 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
@@ -262,6 +262,7 @@ end | |||
262 | 262 | ||
263 | local function backup_existing(should_backup, target) | 263 | local function backup_existing(should_backup, target) |
264 | if not should_backup then | 264 | if not should_backup then |
265 | fs.delete(target) | ||
265 | return | 266 | return |
266 | end | 267 | end |
267 | if fs.exists(target) then | 268 | if fs.exists(target) then |
@@ -301,6 +302,7 @@ local function op_rename(op) | |||
301 | 302 | ||
302 | if fs.exists(op.src) then | 303 | if fs.exists(op.src) then |
303 | fs.make_dir(dir.dir_name(op.dst)) | 304 | fs.make_dir(dir.dir_name(op.dst)) |
305 | fs.delete(op.dst) | ||
304 | local ok, err = fs.move(op.src, op.dst) | 306 | local ok, err = fs.move(op.src, op.dst) |
305 | fs.remove_dir_tree_if_empty(dir.dir_name(op.src)) | 307 | fs.remove_dir_tree_if_empty(dir.dir_name(op.src)) |
306 | return ok, err | 308 | return ok, err |