@samitouri / QOSAMI-WSL / commits / f2e03234

Simplify SetupTestDirectory (#40964)

beena352 committed Jul 1, 2026 at 10:49 UTC f2e032345464c0d237104e351a122dbf645242cc
1 file changed +2 -6
test/windows/wslc/e2e/WSLCE2EHelpers.h
+2 -6
@@ -139,12 +139,8 @@ void WriteTestFileContent(const std::filesystem::path& filePath, const std::stri
139 // Sets up a clean test directory and returns a scope_exit to remove it.
140 inline auto SetupTestDirectory(const std::filesystem::path& directory)
141 {
142 - std::error_code ec;
143 - std::filesystem::remove_all(directory, ec);
144 - THROW_HR_IF_MSG(E_FAIL, ec.value() != 0 && std::filesystem::exists(directory), "%hs", ec.message().c_str());
145 -
146 - std::filesystem::create_directories(directory, ec);
147 - THROW_HR_IF_MSG(E_FAIL, ec.value() != 0 || !std::filesystem::exists(directory), "%hs", ec.message().c_str());
142 + std::filesystem::remove_all(directory);
143 + std::filesystem::create_directories(directory);
144
145 return wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [directory]() {
146 std::error_code removeError;