Skip to content

Commit

Permalink
fix: ReplaceFile issue in luajit (windows).
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Mar 9, 2019
1 parent 1e0e352 commit 86120d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions z.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86120d2

Please sign in to comment.