fgerlits commented on code in PR #1409:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1409#discussion_r963843646
##########
libminifi/test/unit/FileUtilsTests.cpp:
##########
@@ -52,43 +52,43 @@ TEST_CASE("TestFileUtils::concat_path", "[TestConcatPath]")
{
TEST_CASE("TestFileUtils::get_parent_path", "[TestGetParentPath]") {
#ifdef WIN32
- REQUIRE("foo\\" == FileUtils::get_parent_path("foo\\bar"));
- REQUIRE("foo\\" == FileUtils::get_parent_path("foo\\bar\\"));
- REQUIRE("C:\\foo\\" == FileUtils::get_parent_path("C:\\foo\\bar"));
- REQUIRE("C:\\foo\\" == FileUtils::get_parent_path("C:\\foo\\bar\\"));
- REQUIRE("C:\\" == FileUtils::get_parent_path("C:\\foo"));
- REQUIRE("C:\\" == FileUtils::get_parent_path("C:\\foo\\"));
- REQUIRE("" == FileUtils::get_parent_path("C:\\")); //
NOLINT(readability-container-size-empty)
- REQUIRE("" == FileUtils::get_parent_path("C:\\\\")); //
NOLINT(readability-container-size-empty)
+ CHECK("foo" == FileUtils::get_parent_path("foo\\bar"));
+ CHECK("foo\\bar" == FileUtils::get_parent_path("foo\\bar\\"));
Review Comment:
This is how `std::filesystem::path::parent_path()` and
`std::filesystem::path::filename()` work: `std::filesystem::path{"foo\\bar\\"}`
(or `std::filesystem::path{"foo/bar/"}` on Linux) do not refer to the `bar`
directory, but to a file with an empty filename in the `bar` directory.
I agree this is unexpected, but as this is how the standard library works, I
figured I'd change the code where we call it instead of wrapping the standard
library functions to change their behavior.
--
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]