Test: Add argument to not delete test files in the home directory

This commit is contained in:
Riyyi
2022-03-06 16:33:18 +01:00
parent 7f1558bc64
commit 57d50a6dbb
+5 -1
View File
@@ -54,7 +54,7 @@ void createTestDotfiles(const std::vector<std::string>& fileNames, const std::ve
} }
} }
void removeTestDotfiles(const std::vector<std::string>& files) void removeTestDotfiles(const std::vector<std::string>& files, bool deleteInHome = true)
{ {
for (auto file : files) { for (auto file : files) {
// Get the top-level directory // Get the top-level directory
@@ -68,6 +68,10 @@ void removeTestDotfiles(const std::vector<std::string>& files)
std::filesystem::remove_all(file); std::filesystem::remove_all(file);
} }
if (!deleteInHome) {
continue;
}
// Delete recursively in home directory // Delete recursively in home directory
file = homeDirectory / file; file = homeDirectory / file;
if (std::filesystem::exists(file) || std::filesystem::is_symlink(file)) { if (std::filesystem::exists(file) || std::filesystem::is_symlink(file)) {