1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-18 13:49:50 +00:00

fixed: os.path.isdir not work for symbol links close #59.

This commit is contained in:
skywind3000
2019-03-02 11:55:39 +08:00
parent 38c1741f4f
commit f92ad79e2c
2 changed files with 8 additions and 3 deletions

View File

@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
## History
- 1.5.11 (2019-03-02): fixed: os.path.isdir not work for symbol link folders.
- 1.5.10 (2019-03-01): Prevent writing file racing.
- 1.5.9 (2019-02-25): `z -b` should not match current directory (close #56).
- 1.5.8 (2019-02-21): new `$_ZL_FZF_HEIGHT` to control `--height` parameter in fzf.

10
z.lua
View File

@@ -4,7 +4,7 @@
-- z.lua - a cd command that learns, by skywind 2018, 2019
-- Licensed under MIT license.
--
-- Version 1.5.10, Last Modified: 2019/03/01 13:08
-- Version 1.5.11, Last Modified: 2019/03/02 11:37
--
-- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -427,8 +427,6 @@ function os.path.isdir(pathname)
elseif windows then
if pathname == '\\' then
return true
elseif pathname:match('^%a:[/\\]$') then
return true
end
end
local name = pathname
@@ -453,6 +451,12 @@ function os.path.exists(name)
io.close(f)
return true
end
elseif name:sub(-1) == '/' and code == 20 and (not windows) then
local test = name .. '.'
ok, err, code = os.rename(test, test)
if code == 16 or code == 13 then
return true
end
end
return false
end