]> Sergey Matveev's repositories - nnn.git/commitdiff
Do not open current dir in nez context when extracting archive
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 19 Jun 2021 07:30:50 +0000 (13:00 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 19 Jun 2021 07:30:50 +0000 (13:00 +0530)
src/nnn.c

index 80bcf0eefd8d2151a82c71d9d750688df81dcc7d..06eef652b47450a82e8e37a41dab726e82be1390 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4291,14 +4291,16 @@ static bool handle_archive(char *fpath /* in-out param */, char op)
                        printwait(messages[MSG_CANCEL], NULL);
                        return FALSE;
                }
-
-               if (!xmktree(outdir, TRUE) || (chdir(outdir) == -1)) {
-                       printwarn(NULL);
-                       return FALSE;
+               /* Do not create smart context for current dir */
+               if (!(*outdir == '.' && outdir[1] == '\0')) {
+                       if (!xmktree(outdir, TRUE) || (chdir(outdir) == -1)) {
+                               printwarn(NULL);
+                               return FALSE;
+                       }
+                       /* Copy the new dir path to open it in smart context */
+                       outdir = realpath(".", NULL);
+                       x_to = TRUE;
                }
-               /* Copy the new dir path to open it in smart context */
-               outdir = realpath(".", NULL);
-               x_to = TRUE;
        }
 
        if (getutil(utils[UTIL_ATOOL])) {