From 5a9d1ed88a04212e2e4ee5b4f90a609b334bd320 Mon Sep 17 00:00:00 2001 From: Marcel Rodrigues Date: Sun, 13 Dec 2015 17:34:20 -0200 Subject: [PATCH] Add error messages for when file/dir creation fails. --- rover.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/rover.c b/rover.c index f9db886..3c5838a 100644 --- a/rover.c +++ b/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); } -- 2.11.4.GIT