diff --git a/test/ftp/client.cpp b/test/ftp/client.cpp index bebfd29f..39545794 100644 --- a/test/ftp/client.cpp +++ b/test/ftp/client.cpp @@ -137,11 +137,13 @@ class client : public testing::Test void TearDown() override { - // TODO: The server_root_dir_ may not exist. /* Clean up the server root directory after each test. */ - for (const std::filesystem::directory_entry & path : std::filesystem::directory_iterator(server_root_dir_)) + if (std::filesystem::exists(server_root_dir_)) { - std::filesystem::remove_all(path); + for (const std::filesystem::directory_entry & path : std::filesystem::directory_iterator(server_root_dir_)) + { + std::filesystem::remove_all(path); + } } }