Browse Source

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

master
Riyyi 3 years ago
parent
commit
57d50a6dbb
  1. 6
      test/unit/testdotfile.cpp

6
test/unit/testdotfile.cpp

@ -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)) {

Loading…
Cancel
Save