From 57d50a6dbbf9420079e779425415fe602f3bb3bb Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sun, 6 Mar 2022 16:33:18 +0100 Subject: [PATCH] Test: Add argument to not delete test files in the home directory --- test/unit/testdotfile.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/unit/testdotfile.cpp b/test/unit/testdotfile.cpp index b569df1..84e658a 100644 --- a/test/unit/testdotfile.cpp +++ b/test/unit/testdotfile.cpp @@ -54,7 +54,7 @@ void createTestDotfiles(const std::vector& fileNames, const std::ve } } -void removeTestDotfiles(const std::vector& files) +void removeTestDotfiles(const std::vector& files, bool deleteInHome = true) { for (auto file : files) { // Get the top-level directory @@ -68,6 +68,10 @@ void removeTestDotfiles(const std::vector& files) std::filesystem::remove_all(file); } + if (!deleteInHome) { + continue; + } + // Delete recursively in home directory file = homeDirectory / file; if (std::filesystem::exists(file) || std::filesystem::is_symlink(file)) {