]> Sergey Matveev's repositories - nnn.git/commitdiff
Check if path exists before trying to create
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 22 Jan 2020 14:39:16 +0000 (20:09 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 22 Jan 2020 14:39:16 +0000 (20:09 +0530)
src/nnn.c

index 1d6fbf6118e7f14b3fd24acfc1b9a451fc39acbb..ecf17e177759678236d57ad357c538f1d812996e 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5796,7 +5796,7 @@ static bool setup_config(void)
        xstrlcpy(plugindir, cfgdir, len);
        DPRINTF_S(plugindir);
 
-       if (!xmktree(plugindir, TRUE)) {
+       if (access(plugindir, F_OK) && !xmktree(plugindir, TRUE)) {
                xerror();
                return FALSE;
        }
@@ -5808,7 +5808,7 @@ static bool setup_config(void)
        xstrlcpy(sessiondir, cfgdir, len);
        DPRINTF_S(sessiondir);
 
-       if (!xmktree(sessiondir, TRUE)) {
+       if (access(sessiondir, F_OK) && !xmktree(sessiondir, TRUE)) {
                xerror();
                return FALSE;
        }