src/nnn.c | 9 +++++++-- diff --git a/src/nnn.c b/src/nnn.c index 4b51ec7bf80412964c628f519495b7066fa473ec..e5f0d00c57e38c8a6cda337fe709a8a1484b7a61 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3404,9 +3404,14 @@ xstrlcpy(newpath + _len - 1, tmp, PATH_MAX - _len); 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; }