diff --git a/README.md b/README.md index 1d7678b..52c7c36 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.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. diff --git a/z.lua b/z.lua index 5499a3e..6a4e2a0 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.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