Skip to content

Commit

Permalink
Fixed bool function --> int function and added better response returns (
Browse files Browse the repository at this point in the history
#89)


Signed-off-by: Leanid Astrakou <[email protected]>
  • Loading branch information
DivergentEuropeans authored and ifakhrutdinov committed Oct 16, 2019
1 parent 0a32779 commit fff6bc6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions c/httpfileservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@ bool isDir(char *absolutePath) {

status = fileInfo(absolutePath, &info, &returnCode, &reasonCode);
if (status == -1) {
return -1;
return false;
}

return (fileInfoIsDirectory(&info));
}

/* Returns a boolean value for whether or not
* the specified file exists.
* the specified file/directory exists.
*/
bool doesFileExist(char *absolutePath) {
int returnCode = 0, reasonCode = 0, status = 0;
FileInfo info = {0};

status = fileInfo(absolutePath, &info, &returnCode, &reasonCode);
if (status == -1) {
return FALSE;
return false;
}

return TRUE;
return true;
}

/* Creates a new unix directory at the specified absolute
Expand Down Expand Up @@ -160,7 +160,7 @@ void deleteUnixDirectoryAndRespond(HttpResponse *response, char *absolutePath) {
response200WithMessage(response, "Successfully deleted a directory");
}
else {
respondWithJsonError(response, "Failed to delete a directory", 500, "Internal Server Error");
respondWithJsonError(response, "Failed to delete a directory", 400, "Bad Request");
}
}

Expand Down Expand Up @@ -195,7 +195,7 @@ void deleteUnixFileAndRespond(HttpResponse *response, char *absolutePath) {
response200WithMessage(response, "Successfully deleted a file");
}
else {
respondWithJsonError(response, "Failed to delete a file", 500, "Internal Server Error");
respondWithJsonError(response, "Failed to delete a file", 400, "Bad Request");
}
}

Expand Down

0 comments on commit fff6bc6

Please sign in to comment.