mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Test if we can back out/enter directories
This commit is contained in:
parent
aedec0ddf3
commit
48f9c5a79d
10
noice.c
10
noice.c
|
@ -615,6 +615,10 @@ nochange:
|
|||
/* There is no going back */
|
||||
if (strcmp(path, "/") == 0)
|
||||
goto nochange;
|
||||
if (testopendir(path) == 0) {
|
||||
printwarn();
|
||||
goto nochange;
|
||||
}
|
||||
dir = xdirname(path);
|
||||
free(path);
|
||||
path = dir;
|
||||
|
@ -642,6 +646,10 @@ nochange:
|
|||
|
||||
switch (sb.st_mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
if (testopendir(path) == 0) {
|
||||
printwarn();
|
||||
goto nochange;
|
||||
}
|
||||
free(path);
|
||||
path = xrealpath(name);
|
||||
/* Reset filter */
|
||||
|
@ -745,7 +753,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Test initial path */
|
||||
if (!testopendir(ipath))
|
||||
if (testopendir(ipath) == 0)
|
||||
printerr(1, ipath);
|
||||
|
||||
/* Set locale before curses setup */
|
||||
|
|
Loading…
Reference in a new issue