| 187 | } |
| 188 | |
| 189 | std::string PutFile::tmpWritePath(const std::string &filename, const std::string &directory) const { |
| 190 | utils::Identifier tmpFileUuid = id_generator_->generate(); |
| 191 | std::stringstream tmpFileSs; |
| 192 | tmpFileSs << directory; |
| 193 | auto lastSeparatorPos = filename.find_last_of(utils::file::FileUtils::get_separator()); |
| 194 | |
| 195 | if (lastSeparatorPos == std::string::npos) { |
| 196 | tmpFileSs << utils::file::FileUtils::get_separator() << "." << filename; |
| 197 | } else { |
| 198 | tmpFileSs << utils::file::FileUtils::get_separator() << filename.substr(0, lastSeparatorPos) << utils::file::FileUtils::get_separator() << "." << filename.substr(lastSeparatorPos + 1); |
| 199 | } |
| 200 | |
| 201 | tmpFileSs << "." << tmpFileUuid.to_string(); |
| 202 | std::string tmpFile = tmpFileSs.str(); |
| 203 | return tmpFile; |
| 204 | } |
| 205 | |
| 206 | bool PutFile::putFile(core::ProcessSession *session, std::shared_ptr<core::FlowFile> flowFile, const std::string &tmpFile, const std::string &destFile, const std::string &destDir) { |
| 207 | struct stat dir_stat; |
no test coverage detected