fgerlits commented on code in PR #2069:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2069#discussion_r2705029853


##########
libminifi/src/properties/Properties.cpp:
##########
@@ -157,8 +158,41 @@ void fixValidatedProperty(const std::string& property_name,
     needs_to_persist_new_value = false;
   }
 }
+
+auto getExtraPropertiesFileNames(const std::filesystem::path& 
extra_properties_files_dir, const std::shared_ptr<core::logging::Logger>& 
logger) {
+  std::vector<std::filesystem::path> extra_properties_file_names;
+  if (utils::file::exists(extra_properties_files_dir) && 
utils::file::is_directory(extra_properties_files_dir)) {
+    utils::file::list_dir(extra_properties_files_dir, [&](const 
std::filesystem::path&, const std::filesystem::path& file_name) {
+      if (file_name.string().ends_with(".properties")) {
+        extra_properties_file_names.push_back(file_name);
+      }
+      return true;
+    }, logger, /* recursive = */ false);
+  }
+  std::ranges::sort(extra_properties_file_names);
+  return extra_properties_file_names;
+}
+
+void updateChangedPropertiesInPropertiesFile(minifi::PropertiesFile& 
current_content, const auto& properties) {
+  for (const auto& prop : properties) {
+    if (!prop.second.need_to_persist_new_value) {
+      continue;
+    }
+    if (current_content.hasValue(prop.first)) {
+      current_content.update(prop.first, prop.second.persisted_value);
+    } else {
+      current_content.append(prop.first, prop.second.persisted_value);
+    }
+  }
+}
 }  // namespace
 
+std::filesystem::path PropertiesImpl::extra_properties_files_dir_name() const {

Review Comment:
   good point; fixed in 52ba4041c97ec17c184dbb9b829059f0feecfe18



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to