I'm using a switch statement to check the value of the error code in the libzip zip archive that I'm creating. However, it never seems to return anything other than 0, even when I cause it to fail on purpose. (I'm causing it to fail by trying to copy files to a usb drive that is 100% full).
How is my usage incorrect here?
int error = 0;
zip_t * zip = zip_open(externalDevicePath.c_str(), ZIP_CREATE, &error);
zip_add_dir(zip,(institutionId + DIR_SLASH + userId).c_str());
string instAndUserPath = basePath + DIR_SLASH + institutionId + DIR_SLASH + userId;
string stbackupPath = basePath + DIR_SLASH + "STBackups";
ESFileUtilsCommon::addDirectoryToZip(instAndUserPath,zip,(institutionId + DIR_SLASH + userId).c_str());
ESFileUtilsCommon::addDirectoryToZip(stbackupPath,zip,"STBackups");
ESFileUtilsCommon::addDirectoryContentsToZip(basePath, zip);
zip_close(zip);
switch (error){
case ZIP_ER_OK:
mapper.setResult(RESULT_SUCCESS);
retval = CefV8Value::CreateString(mapper.getMappedJsonResponse());
return true;
break;
default:
mapper.setResult(RESULT_FAILURE);
retval = CefV8Value::CreateString(mapper.getMappedJsonResponse());
return false;
break;
}