aboutsummaryrefslogtreecommitdiff
path: root/src/copy_install.cc
diff options
context:
space:
mode:
authordacctal <dacctalyt@gmail.com>2026-04-03 14:56:05 +0000
committerdacctal <dacctalyt@gmail.com>2026-04-03 14:56:05 +0000
commited78991edc4755c0276dcb4eb454b43fa38296fc (patch)
tree460da5399e34e1dce7a293cb22578da15977d895 /src/copy_install.cc
parent2a6b92ed130ade1ea7542ee210e6957427a0aa81 (diff)
countless changes
Diffstat (limited to 'src/copy_install.cc')
-rw-r--r--src/copy_install.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/copy_install.cc b/src/copy_install.cc
new file mode 100644
index 0000000..4e6294e
--- /dev/null
+++ b/src/copy_install.cc
@@ -0,0 +1,33 @@
+#include <filesystem>
+#include <iostream>
+#include <string>
+#include <unistd.h>
+
+#include "copy_install.hh"
+#include "vars.hh"
+
+void copy_install(std::filesystem::path build_dir) {
+ for (auto const& dir_entry : std::filesystem::recursive_directory_iterator(build_dir)) {
+ if (dir_entry.path().extension().string().rfind(".so", 0) == 0) {
+ if (!std::filesystem::exists(lib+"/"+dir_entry.path().filename().string())) {
+ copy(dir_entry, lib+"/"+dir_entry.path().filename().string());
+ if (is_verbose) { std::cout << print_pkgit << "copied library: " << dir_entry << "\n"; }
+ } else { /*std::cout << print_pkgit << "library already exists: " << dir_entry << "\n";*/ }
+
+ } else if (!access(dir_entry.path().c_str(), X_OK) && !is_directory(dir_entry.path())) {
+ if (!std::filesystem::exists(bin+"/"+dir_entry.path().filename().string()) &&
+ dir_entry.path().filename().string() != "bldit" &&
+ dir_entry.path().filename().string() != "build.sh" &&
+ dir_entry.path().filename().string() != "compile.sh") {
+ copy(dir_entry, bin+"/"+dir_entry.path().filename().string());
+ if (is_verbose) { std::cout << print_pkgit << "copied executable: " << dir_entry << "\n"; }
+ } else { /*std::cout << print_pkgit << "executable already exists: " << dir_entry << "\n";*/ }
+
+ } else if (dir_entry.path().extension() == ".h") {
+ if (!std::filesystem::exists(include+"/"+dir_entry.path().filename().string())) {
+ copy(dir_entry, include+"/"+dir_entry.path().filename().string());
+ if (is_verbose) { std::cout << print_pkgit << "copied include: " << dir_entry << "\n"; }
+ } else { /*std::cout << print_pkgit << "include already exists: " << dir_entry << "\n";*/ }
+ }
+ }
+}