From c992bb4c7cc230eff246f5368b7fc765750eec5b Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 28 Oct 2020 10:17:47 +0000 Subject: feature: move command --- easydir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'easydir.c') diff --git a/easydir.c b/easydir.c index 9337fe1..162bae7 100644 --- a/easydir.c +++ b/easydir.c @@ -31,11 +31,12 @@ int checkFileExist(char *path_to_file) { FILE *pFile; - pFile = fopen(path_to_file, "r"); + pFile = fopen(path_to_file, "r+"); // r+ so that errno can equal EISDIR if(pFile == NULL) { - if(errno == ENOENT) { // file doesn't exist + if(errno == ENOENT) // file doesn't exist return 0; - } + if(errno == EISDIR) // it's directory + return 2; else callError(120); } fclose(pFile); -- cgit v1.2.3-18-g5258