diff options
| author | NPScript <nathan@reinerweb.ch> | 2021-12-21 09:39:56 +0100 |
|---|---|---|
| committer | NPScript <nathan@reinerweb.ch> | 2021-12-21 09:39:56 +0100 |
| commit | e1343689774367ff1fb8f907e1e3324f0f37fec7 (patch) | |
| tree | 6174f45918267af02718175cc8bd0ad63d88a8d1 | |
| parent | e7f5449080dbf4e60bca9a2b2e3ce670d289d496 (diff) | |
fixes #1; no-permission preview crash fix
| -rw-r--r-- | luis.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -9,6 +9,7 @@ #include <magic.h> #include <limits.h> #include <unistd.h> +#include <errno.h> const char DTC[] = { [DT_BLK] = 'b', @@ -230,6 +231,16 @@ void print_preview(Window * win) { SET_COLOR(100, 100, 100); printfxy_to_window(win, 0, 5, "Content"); RESET_VIDEO(); + + DIR * dir = opendir(filepath); + + if (dir == NULL) { + SET_COLOR(180, 60, 60); + printfxy_to_window(win, 0, 7, strerror(errno)); + RESET_VIDEO(); + return; + } + write_dir_content_to_win(win, filepath, -1, 7); } } |