diff --git a/README.md b/README.md index 696da90..921c017 100644 --- a/README.md +++ b/README.md @@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource. ## History +- 1.7.0 (2019-03-09): Support ranger, fix ReplaceFile issue in luajit (windows). - 1.6.0 (2019-03-04): optimize with ffi module (luajit builtin module). - 1.5.11 (2019-03-02): fixed: os.path.isdir doesn't work for symbol link folders. - 1.5.10 (2019-03-01): Prevent writing file racing. diff --git a/z.lua b/z.lua index 2d91082..5e4ef44 100755 --- a/z.lua +++ b/z.lua @@ -4,7 +4,7 @@ -- z.lua - a cd command that learns, by skywind 2018, 2019 -- Licensed under MIT license. -- --- Version 1.6.0, Last Modified: 2019/03/04 14:47 +-- Version 1.7.0, Last Modified: 2019/03/09 16:51 -- -- * 10x faster than fasd and autojump, 3x faster than z.sh -- * available for posix shells: bash, zsh, sh, ash, dash, busybox @@ -1106,7 +1106,10 @@ function data_save(filename, M) fp:close() if tmpname ~= nil then if windows then - os.native.ReplaceFile(filename, tmpname) + local ok, err, code = os.rename(tmpname, filename) + if not ok then + os.native.ReplaceFile(filename, tmpname) + end else os.rename(tmpname, filename) end