]> Sergey Matveev's repositories - nnn.git/commitdiff
Show warnings for copy, move, multiple remove
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 20 Nov 2018 14:28:07 +0000 (19:58 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 20 Nov 2018 14:28:07 +0000 (19:58 +0530)
src/nnn.c

index 6898bb865f4a3df3f18686cdd9cc7b999c6a7191..d6d66a1de1a12a9af863b4241cfb57dc8ca39ec2 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3046,11 +3046,24 @@ nochange:
                case SEL_MV:
                case SEL_RMMUL:
                {
+                       /* Fail if copy file path not generated */
                        if (!g_cppath[0]) {
                                printmsg("copy file not found");
                                goto nochange;
                        }
 
+                       /* Warn if selection not completed */
+                       if (cfg.copymode) {
+                               printmsg("finish selection first");
+                               goto nochange;
+                       }
+
+                       /* Fail if copy file path isn't created */
+                       if (access(g_cppath, R_OK) == -1) {
+                               printmsg("empty selection list");
+                               goto nochange;
+                       }
+
                        if (sel == SEL_CP)
                                snprintf(g_buf, MAX_CMD_LEN, "xargs -0 -d \'\n\' -a %s cp -ir --preserve=all -t .", g_cppath);
                        else if (sel == SEL_MV)