From a72786a38ffaa7128f98b07b325a0212a0530008 Mon Sep 17 00:00:00 2001 From: Pradana Aumars Date: Sat, 12 Jun 2021 10:57:08 +0200 Subject: [PATCH] Remove install.c CPP file --- src/install.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/install.c diff --git a/src/install.c b/src/install.c deleted file mode 100644 index 0d3558d..0000000 --- a/src/install.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "install.h" - -int -backup() -{ - struct stat sb; - - const std::string bkp = hd + _prefix + "_backup/"; - - struct stat stat_dir; - if (stat(bkp.c_str(), &stat_dir) != 0) - { - mkdir(bkp.c_str(), 0700); - } - - for (auto &i : _vec) - { - const std::string source_file = hd + _prefix + "/" + i; - const std::string dest_file = bkp + i; - - std::cout << "Backing up " << _prefix << "/" << i << "\n"; - - int source = open(source_file.c_str(), O_RDONLY, 0); - int dest = open(dest_file.c_str(), O_WRONLY | O_CREAT /*| O_TRUNC/**/, 0644); - - // struct required, rationale: function stat() exists also - struct stat stat_source; - fstat(source, &stat_source); - sendfile(dest, source, 0, stat_source.st_size); - - close(source); - close(dest); - - if (access(dest_file.c_str(), F_OK) != 0) - { - throw ExceptionHandler(CUSTOM_ERROR, "Backing up " + dest_file + " failed!"); - } - } -}