mirror of
https://github.com/jarun/nnn.git
synced 2024-11-17 08:32:36 +00:00
Archive handling on OS X using unar+lsar
This commit is contained in:
parent
71d27de517
commit
7c54f073fc
27
nnn.c
27
nnn.c
|
@ -252,7 +252,12 @@ static char * const utils[] = {
|
||||||
"/usr/bin/xdg-open",
|
"/usr/bin/xdg-open",
|
||||||
#endif
|
#endif
|
||||||
"nlay",
|
"nlay",
|
||||||
|
#ifdef __APPLE__
|
||||||
|
"unar",
|
||||||
|
"lsar"
|
||||||
|
#else
|
||||||
"atool"
|
"atool"
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Common message strings */
|
/* Common message strings */
|
||||||
|
@ -1629,6 +1634,21 @@ show_mediainfo(char *fpath, char *arg)
|
||||||
static int
|
static int
|
||||||
handle_archive(char *fpath, char *arg, char *dir)
|
handle_archive(char *fpath, char *arg, char *dir)
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (arg[1] == 'x') {
|
||||||
|
if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[4], NULL, 0))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
spawn(utils[4], fpath, NULL, dir, F_NORMAL);
|
||||||
|
} else {
|
||||||
|
if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[5], NULL, 0))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
exitcurses();
|
||||||
|
get_output(NULL, 0, utils[5], fpath, NULL, 1);
|
||||||
|
initcurses();
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[4], NULL, 0))
|
if (!get_output(g_buf, MAX_CMD_LEN, "which", utils[4], NULL, 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -1639,6 +1659,7 @@ handle_archive(char *fpath, char *arg, char *dir)
|
||||||
get_output(NULL, 0, utils[4], arg, fpath, 1);
|
get_output(NULL, 0, utils[4], arg, fpath, 1);
|
||||||
initcurses();
|
initcurses();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2585,8 +2606,14 @@ nochange:
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
if (sel == SEL_MEDIA || sel == SEL_FMEDIA)
|
if (sel == SEL_MEDIA || sel == SEL_FMEDIA)
|
||||||
sprintf(g_buf, "%s missing", utils[cfg.metaviewer]);
|
sprintf(g_buf, "%s missing", utils[cfg.metaviewer]);
|
||||||
|
else {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (sel == SEL_LIST)
|
||||||
|
sprintf(g_buf, "%s missing", utils[5]);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
sprintf(g_buf, "%s missing", utils[4]);
|
sprintf(g_buf, "%s missing", utils[4]);
|
||||||
|
}
|
||||||
|
|
||||||
printmsg(g_buf);
|
printmsg(g_buf);
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
|
Loading…
Reference in a new issue