Commit Diff


commit - 266d19506eed11d6dc98061422ddda73d7b838f0
commit + 5a9d1ed88a04212e2e4ee5b4f90a609b334bd320
blob - f9db886cfd2d2ecf9317cde6a6645f2554ddc18d
blob + 3c5838afd93cbad3375f356608972dc95d76c988
--- rover.c
+++ rover.c
@@ -1164,10 +1164,12 @@ main(int argc, char *argv[])
             clear_message();
             if (edit_stat == CONFIRM) {
                 if (ok) {
-                    addfile(INPUT);
-                    cd(1);
-                    try_to_sel(INPUT);
-                    update_view();
+                    if (addfile(INPUT) == 0) {
+                        cd(1);
+                        try_to_sel(INPUT);
+                        update_view();
+                    } else
+                        message(RED, "Could not create \"%s\".", INPUT);
                 } else
                     message(RED, "\"%s\" already exists.", INPUT);
             }
@@ -1193,11 +1195,13 @@ main(int argc, char *argv[])
             clear_message();
             if (edit_stat == CONFIRM) {
                 if (ok) {
-                    adddir(INPUT);
-                    cd(1);
-                    strcat(INPUT, "/");
-                    try_to_sel(INPUT);
-                    update_view();
+                    if (adddir(INPUT) == 0) {
+                        cd(1);
+                        strcat(INPUT, "/");
+                        try_to_sel(INPUT);
+                        update_view();
+                    } else
+                        message(RED, "Could not create \"%s/\".", INPUT);
                 } else
                     message(RED, "\"%s\" already exists.", INPUT);
             }