in sdk/src/resumable/FileDownloadRequest.cc [77:108]
int FileDownloadRequest::validate() const
{
auto ret = PdsResumableBaseRequest::validate();
if (ret != 0) {
return ret;
}
#if !defined(_WIN32)
if (!filePathW_.empty()) {
return ARG_ERROR_PATH_NOT_SUPPORT_WSTRING_TYPE;
}
#endif
if (filePath_.empty() && filePathW_.empty()) {
return ARG_ERROR_DOWNLOAD_FILE_PATH_EMPTY;
}
//path and checkpoint must be same type.
if ((!filePath_.empty() && !checkpointDirW_.empty()) ||
(!filePathW_.empty() && !checkpointDir_.empty())) {
return ARG_ERROR_PATH_NOT_SAME_TYPE;
}
//check tmpfilePath is available
auto stream = GetFstreamByPath(tempFilePath_, tempFilePathW_, std::ios::out | std::ios::app);
if (!stream->is_open()) {
return ARG_ERROR_OPEN_DOWNLOAD_TEMP_FILE;
}
stream->close();
return 0;
}