Skip to content

Commit 86120d2

Browse files
author
skywind3000
committed
fix: ReplaceFile issue in luajit (windows).
1 parent 1e0e352 commit 86120d2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
458458

459459
## History
460460

461+
- 1.7.0 (2019-03-09): Support ranger, fix ReplaceFile issue in luajit (windows).
461462
- 1.6.0 (2019-03-04): optimize with ffi module (luajit builtin module).
462463
- 1.5.11 (2019-03-02): fixed: os.path.isdir doesn't work for symbol link folders.
463464
- 1.5.10 (2019-03-01): Prevent writing file racing.

z.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- z.lua - a cd command that learns, by skywind 2018, 2019
55
-- Licensed under MIT license.
66
--
7-
-- Version 1.6.0, Last Modified: 2019/03/04 14:47
7+
-- Version 1.7.0, Last Modified: 2019/03/09 16:51
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -1106,7 +1106,10 @@ function data_save(filename, M)
11061106
fp:close()
11071107
if tmpname ~= nil then
11081108
if windows then
1109-
os.native.ReplaceFile(filename, tmpname)
1109+
local ok, err, code = os.rename(tmpname, filename)
1110+
if not ok then
1111+
os.native.ReplaceFile(filename, tmpname)
1112+
end
11101113
else
11111114
os.rename(tmpname, filename)
11121115
end

0 commit comments

Comments
 (0)