aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Mischievous Meerkat <engineerarun@gmail.com>2019-08-10 07:06:40 +0530
committerGravatar GitHub <noreply@github.com>2019-08-10 07:06:40 +0530
commit199fb3ca2972e3909969fe0176a7f03daf751481 (patch)
tree26daaed1e612ecd95a62b0748ceaf19c41f7c5c8 /src
parent6481c812bdc094712809894ab5aaa5c371360043 (diff)
parent2baa42b877ca0bc338a1852397ca3a0aa7c30b79 (diff)
downloadnnn-199fb3ca2972e3909969fe0176a7f03daf751481.tar.gz
Merge pull request #313 from 0xACE/relativearchives
Make selection based archives use relative paths
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 386cf1f..92ee148 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1300,7 +1300,10 @@ 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);
+#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