aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-03-01 21:00:45 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-03-01 21:00:45 +0530
commit146f24e5de94759349d0b1cdc54daca6514da79d (patch)
tree29c14dc5c67db08171a036499324d827970fb94e /src
parent78d0ea50f41ff53e533be10cd96aa2685cc34d1f (diff)
downloadnnn-146f24e5de94759349d0b1cdc54daca6514da79d.tar.gz
Use target vars to create dirs
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 48df0b0..1443e67 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -6508,10 +6508,8 @@ static bool setup_config(void)
DPRINTF_S(cfgdir);
/* Create ~/.config/nnn/plugins */
- xstrlcpy(cfgdir + r + 4 - 1, "/plugins", 9); /* subtract length of "/nnn" (4) */
- DPRINTF_S(cfgdir);
-
- xstrlcpy(plugindir, cfgdir, len);
+ xstrlcpy(plugindir, cfgdir, PATH_MAX);
+ xstrlcpy(plugindir + r + 4 - 1, "/plugins", 9); /* subtract length of "/nnn" (4) */
DPRINTF_S(plugindir);
if (access(plugindir, F_OK) && !xmktree(plugindir, TRUE)) {
@@ -6520,10 +6518,8 @@ static bool setup_config(void)
}
/* Create ~/.config/nnn/sessions */
- xstrlcpy(cfgdir + r + 4 - 1, "/sessions", 10); /* subtract length of "/nnn" (4) */
- DPRINTF_S(cfgdir);
-
- xstrlcpy(sessiondir, cfgdir, len);
+ xstrlcpy(sessiondir, cfgdir, PATH_MAX);
+ xstrlcpy(sessiondir + r + 4 - 1, "/sessions", 10); /* subtract length of "/nnn" (4) */
DPRINTF_S(sessiondir);
if (access(sessiondir, F_OK) && !xmktree(sessiondir, TRUE)) {
@@ -6531,10 +6527,6 @@ static bool setup_config(void)
return FALSE;
}
- /* Reset to config path */
- cfgdir[r + 3] = '\0';
- DPRINTF_S(cfgdir);
-
/* Set selection file path */
if (!cfg.picker) {
/* Length of "/.config/nnn/.selection" */