From f117343477e596937bdfcf0ddce447c0d127b9cf Mon Sep 17 00:00:00 2001 From: Stefan Zabka Date: Wed, 20 May 2020 21:13:35 +0200 Subject: Fixed another edge case and documentation --- 02_exercise/prompt_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '02_exercise/prompt_utils.c') diff --git a/02_exercise/prompt_utils.c b/02_exercise/prompt_utils.c index 819509d..4f86811 100644 --- a/02_exercise/prompt_utils.c +++ b/02_exercise/prompt_utils.c @@ -64,7 +64,9 @@ char const *const relative_path(char const *const from_dir, char const *const to for (size_t j = 0; j < levels_up - 1; j++) { strcat(return_value, go_up); } - strcat(return_value, to_dir + common_position); + if (strcmp("/", to_dir) != 0) { + strcat(return_value, to_dir + common_position); + } } arrayRelease((void *)from_dir_indeces); -- cgit v1.2.3-54-g00ecf