From 30651d16d7ff26e5b71cb7c53d0409516e766470 Mon Sep 17 00:00:00 2001 From: 0xACE <0xaced@gmail.com> Date: Sun, 4 Aug 2019 00:41:20 +0200 Subject: [PATCH 1/2] Make selection based archives use relative paths This will create archives relative to your current working directory rather than a full path when when creating the archive based on your current selection. --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 874b2052..1b3557e2 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1302,7 +1302,7 @@ static void archive_selection(const char *cmd, const char *archive, const char * char *buf = (char *)malloc(CMD_LEN_MAX * sizeof(char)); snprintf(buf, CMD_LEN_MAX, #ifdef __linux__ - "xargs -0 -a %s %s %s", g_cppath, cmd, archive); + "sed -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, g_cppath, cmd, archive); #else "cat %s | xargs -0 -o %s %s", g_cppath, cmd, archive); #endif From 2baa42b877ca0bc338a1852397ca3a0aa7c30b79 Mon Sep 17 00:00:00 2001 From: 0xACE <0xaced@gmail.com> Date: Sun, 4 Aug 2019 02:49:48 +0200 Subject: [PATCH 2/2] MacOS support for archive_selection() --- src/nnn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nnn.c b/src/nnn.c index 1b3557e2..6be09d13 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1303,6 +1303,9 @@ static void archive_selection(const char *cmd, const char *archive, const char * snprintf(buf, CMD_LEN_MAX, #ifdef __linux__ "sed -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, g_cppath, cmd, archive); +#elif defined __APPLE__ + "cat '%s' | tr '\\0' '\n' | sed -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s", + g_cppath, curpath, cmd, archive); #else "cat %s | xargs -0 -o %s %s", g_cppath, cmd, archive); #endif