From ed78991edc4755c0276dcb4eb454b43fa38296fc Mon Sep 17 00:00:00 2001 From: dacctal Date: Fri, 3 Apr 2026 14:56:05 +0000 Subject: countless changes --- src/remove_pkg.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/remove_pkg.cc (limited to 'src/remove_pkg.cc') diff --git a/src/remove_pkg.cc b/src/remove_pkg.cc new file mode 100644 index 0000000..fa41bbc --- /dev/null +++ b/src/remove_pkg.cc @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +#include "remove_pkg.hh" +#include "vars.hh" + +void remove_pkg(Pkg pkg) { + for (auto const& dir_entry : std::filesystem::recursive_directory_iterator(pkg.src)) { + if (dir_entry.path().extension().string().rfind(".so", 0) == 0) { + std::filesystem::remove(lib+"/"+dir_entry.path().filename().string()); + std::cout << print_pkgit << "removed library: " << dir_entry << "\n"; + + } else if (!access(dir_entry.path().c_str(), X_OK) && !is_directory(dir_entry.path())) { + std::filesystem::remove(bin+"/"+dir_entry.path().filename().string()); + std::cout << print_pkgit << "removed executable: " << dir_entry << "\n"; + + } else if (dir_entry.path().extension() == ".h") { + std::filesystem::remove(include+"/"+dir_entry.path().filename().string()); + std::cout << print_pkgit << "removed include: " << dir_entry << "\n"; + } + } + remove_all(pkg.src.parent_path()); +} -- cgit v1.2.3