MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / tmpWritePath

Method tmpWritePath

extensions/standard-processors/processors/PutFile.cpp:189–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189std::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
206bool 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;

Callers 1

PutFileTests.cppFile · 0.80

Calls 3

get_separatorFunction · 0.50
generateMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected