martinzink commented on code in PR #1424: URL: https://github.com/apache/nifi-minifi-cpp/pull/1424#discussion_r1044589812
########## minifi_main/MainHelper.cpp: ########## @@ -133,43 +128,41 @@ std::string determineMinifiHome(const std::shared_ptr<logging::Logger>& logger) return ""; }(); - if (minifiHome.empty()) { + if (minifi_home.empty()) { logger->log_error("No " MINIFI_HOME_ENV_KEY " could be inferred. " "Please set " MINIFI_HOME_ENV_KEY " or run minifi from a valid location."); return ""; } /* Verify that MINIFI_HOME is valid */ - bool minifiHomeValid = false; - if (validHome(minifiHome)) { - minifiHomeValid = true; + bool minifi_home_is_valid = false; + if (validHome(minifi_home)) { + minifi_home_is_valid = true; } else { - logger->log_info("%s is not a valid " MINIFI_HOME_ENV_KEY ", because there is no " DEFAULT_NIFI_PROPERTIES_FILE " file in it.", minifiHome); - - std::string minifiHomeWithoutBin; - std::string binDir; - std::tie(minifiHomeWithoutBin, binDir) = minifi::utils::file::split_path(minifiHome); - if (!minifiHomeWithoutBin.empty() && (binDir == "bin" || binDir == std::string("bin") + minifi::utils::file::get_separator())) { - if (validHome(minifiHomeWithoutBin)) { - logger->log_info("%s is a valid " MINIFI_HOME_ENV_KEY ", falling back to it.", minifiHomeWithoutBin); - minifiHomeValid = true; - minifiHome = std::move(minifiHomeWithoutBin); + logger->log_info("%s is not a valid %s, because there is no %s file in it.", minifi_home.string(), MINIFI_HOME_ENV_KEY, DEFAULT_NIFI_PROPERTIES_FILE.string()); + + auto minifi_home_without_bin = minifi_home.parent_path(); + auto bin_dir = minifi_home.filename(); + if (!minifi_home_without_bin.empty() && (bin_dir == std::filesystem::path("bin") || bin_dir == (std::filesystem::path("bin")/""))) { + if (validHome(minifi_home_without_bin)) { + logger->log_info("%s is a valid %s, falling back to it.", minifi_home_without_bin.string()); Review Comment: good catch :+1: , fixed it in https://github.com/apache/nifi-minifi-cpp/pull/1424/commits/6c775d116236c92105c7be38bb284f309c27887c#diff-4ceccfbc1ea6c4b068f7f198d1fc53d5650ec2c057f2145e5bf41040325262c0R148 -- 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: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org