diff --git a/src/nnn.c b/src/nnn.c index 4b51ec7b..e5f0d00c 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3404,12 +3404,17 @@ nochange: tmp = newpath; } - /* Check if file exists */ - if (access(tmp, F_OK) == -1) { + if (lstat(tmp, &sb) == -1) { printwarn(); goto nochange; } + /* Check if it's a directory */ + if (S_ISDIR(sb.st_mode)) { + printmsg("directory"); + goto nochange; + } + dir = NULL; /* dir used as temp var */ if (ndents) dir = dents[cur].name;