sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit 39ac81012ef13e47abec3a7a575d5a3880507694
parent c455c73b83e5b2f992c517eb35b68c304e9095cc
Author: afify <hassan@afify.dev>
Date:   Thu,  3 Dec 2020 18:44:21 +0300

[fix] print basename, mvbk

- use basename() to print entries
- always check_dir before moving back
- fix moving back from root

Diffstat:
Msfm.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sfm.c b/sfm.c @@ -272,7 +272,7 @@ print_row(Pane *pane, size_t entpos, Cpair col) int width; width = (twidth / 2) - 4; - result = pane->direntr[entpos].name; + result = basename(pane->direntr[entpos].name); x = pane->dirx; y = entpos - cpane->firstrow + 1; @@ -455,6 +455,8 @@ get_dirp(char *cdir) counter = 0; len = strlen(cdir); + if (len ==1) + return; for (i = len - 1; i > 1; i--) { if (cdir[i] == '/') @@ -843,8 +845,13 @@ delfd(void) static void mvbk(void) { - rmwatch(cpane); get_dirp(cpane->dirn); + if (check_dir(cpane->dirn) < 0) { + print_error(strerror(errno)); + return; + } + + rmwatch(cpane); cpane->firstrow = 0; cpane->hdir = cpane->parent_row; if (listdir(AddHi, NULL) < 0)