Skip to content

Commit f92ad79

Browse files
author
skywind3000
committed
fixed: os.path.isdir not work for symbol links close #59.
1 parent 38c1741 commit f92ad79

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
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.5.11 (2019-03-02): fixed: os.path.isdir not work for symbol link folders.
461462
- 1.5.10 (2019-03-01): Prevent writing file racing.
462463
- 1.5.9 (2019-02-25): `z -b` should not match current directory (close #56).
463464
- 1.5.8 (2019-02-21): new `$_ZL_FZF_HEIGHT` to control `--height` parameter in fzf.

z.lua

Lines changed: 7 additions & 3 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.5.10, Last Modified: 2019/03/01 13:08
7+
-- Version 1.5.11, Last Modified: 2019/03/02 11:37
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -427,8 +427,6 @@ function os.path.isdir(pathname)
427427
elseif windows then
428428
if pathname == '\\' then
429429
return true
430-
elseif pathname:match('^%a:[/\\]$') then
431-
return true
432430
end
433431
end
434432
local name = pathname
@@ -453,6 +451,12 @@ function os.path.exists(name)
453451
io.close(f)
454452
return true
455453
end
454+
elseif name:sub(-1) == '/' and code == 20 and (not windows) then
455+
local test = name .. '.'
456+
ok, err, code = os.rename(test, test)
457+
if code == 16 or code == 13 then
458+
return true
459+
end
456460
end
457461
return false
458462
end

0 commit comments

Comments
 (0)