Commit Diff


commit - 1d65cfa2ec0ac194745eb3d9c5b16ea1c79c050d
commit + ed9e82416fd9970147be9b8d8c8a5e1170b55f95
blob - 2e48355f0f370bda787bec39e712ca3580b4384a
blob + 723c11a88d523b81d74cfb5ec434ed0ee255480d
--- rover.c
+++ rover.c
@@ -1455,14 +1455,20 @@ paste_path_fail:
             } else
                 message(RED, "No entries marked for deletion.");
         } else if (!strcmp(key, RVK_MARK_COPY)) {
-            if (rover.marks.nentries)
-                process_marked(adddir, cpyfile, NULL, "Copying", "Copied");
-            else
+            if (rover.marks.nentries) {
+                if (strcmp(CWD, rover.marks.dirpath))
+                    process_marked(adddir, cpyfile, NULL, "Copying", "Copied");
+                else
+                    message(RED, "Cannot copy to the same path.");
+            } else
                 message(RED, "No entries marked for copying.");
         } else if (!strcmp(key, RVK_MARK_MOVE)) {
-            if (rover.marks.nentries)
-                process_marked(adddir, movfile, deldir, "Moving", "Moved");
-            else
+            if (rover.marks.nentries) {
+                if (strcmp(CWD, rover.marks.dirpath))
+                    process_marked(adddir, movfile, deldir, "Moving", "Moved");
+                else
+                    message(RED, "Cannot move to the same path.");
+            } else
                 message(RED, "No entries marked for moving.");
         }
     }