mirror of https://github.com/jarun/nnn.git
fixed misleading `else if` & text. removed lastdir
This commit is contained in:
parent
e3393d0437
commit
78ada7a8bc
13
src/nnn.c
13
src/nnn.c
|
@ -3297,16 +3297,10 @@ nochange:
|
||||||
if (getppid() == 1)
|
if (getppid() == 1)
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
|
||||||
/* Check if CWD is deleted and find a existing parent */
|
/* Check if CWD is deleted and find an existing parent */
|
||||||
if (access(path, F_OK)) {
|
if (access(path, F_OK)) {
|
||||||
DPRINTF_S("dir deleted or moved");
|
DPRINTF_S("dir deleted or moved");
|
||||||
|
|
||||||
/* Save last working directory */
|
|
||||||
xstrlcpy(lastdir, path, PATH_MAX);
|
|
||||||
|
|
||||||
/* Save history */
|
|
||||||
xstrlcpy(lastname, xbasename(path), NAME_MAX + 1);
|
|
||||||
|
|
||||||
xstrlcpy(newpath, path, PATH_MAX);
|
xstrlcpy(newpath, path, PATH_MAX);
|
||||||
while (true) {
|
while (true) {
|
||||||
dir = visit_parent(path, newpath, &presel);
|
dir = visit_parent(path, newpath, &presel);
|
||||||
|
@ -3314,7 +3308,8 @@ nochange:
|
||||||
if (!dir)
|
if (!dir)
|
||||||
dir = dirname(newpath);
|
dir = dirname(newpath);
|
||||||
break;
|
break;
|
||||||
} else if (!dir) {
|
}
|
||||||
|
if (!dir) {
|
||||||
xstrlcpy(path, newpath, PATH_MAX);
|
xstrlcpy(path, newpath, PATH_MAX);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3324,7 +3319,7 @@ nochange:
|
||||||
xstrlcpy(path, dir, PATH_MAX);
|
xstrlcpy(path, dir, PATH_MAX);
|
||||||
|
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
mvprintw(xlines - 1, 0, "folder disappeared\n");
|
mvprintw(xlines - 1, 0, "cannot access directory\n");
|
||||||
xdelay();
|
xdelay();
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue