From c14db5bd469a6cb867653d44241a7f98f675d495 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 23 Sep 2021 19:57:17 +0200 Subject: [PATCH] Manager: Rename files to paths --- src/dotfile.cpp | 16 ++++++++-------- src/dotfile.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dotfile.cpp b/src/dotfile.cpp index 5196fb9..e477f0e 100644 --- a/src/dotfile.cpp +++ b/src/dotfile.cpp @@ -134,14 +134,14 @@ void Dotfile::pull(const std::vector& targets) // ----------------------------------------- -void Dotfile::sync(const std::vector& files, const std::vector& homeIndices, const std::vector& systemIndices, +void Dotfile::sync(const std::vector& paths, const std::vector& homeIndices, const std::vector& systemIndices, const std::function& generateHomePaths, const std::function& generateSystemPaths) { bool root = !geteuid() ? true : false; if (!systemIndices.empty() && !root) { for (size_t i : systemIndices) { - fprintf(stderr, "\033[31;1mDotfile:\033[0m you cannot copy system file '%s' unless you are root\n", files.at(i).c_str()); + fprintf(stderr, "\033[31;1mDotfile:\033[0m you cannot copy system file '%s' unless you are root\n", paths.at(i).c_str()); } return; } @@ -196,15 +196,15 @@ void Dotfile::sync(const std::vector& files, const std::vector/ std::string homeDirectory = "/home/" + std::string(user->pw_name); for (size_t i : homeIndices) { - std::string paths[2]; - generateHomePaths(paths, files.at(i), homeDirectory); - copy(paths[0], paths[1], true); + std::string homePaths[2]; + generateHomePaths(homePaths, paths.at(i), homeDirectory); + copy(homePaths[0], homePaths[1], true); } // / for (size_t i : systemIndices) { - std::string paths[2]; - generateSystemPaths(paths, files.at(i)); - copy(paths[0], paths[1], false); + std::string systemPaths[2]; + generateSystemPaths(systemPaths, paths.at(i)); + copy(systemPaths[0], systemPaths[1], false); } } diff --git a/src/dotfile.h b/src/dotfile.h index 6fb79c9..5b3f853 100644 --- a/src/dotfile.h +++ b/src/dotfile.h @@ -40,7 +40,7 @@ public: static void setExcludePaths(const std::vector& excludePaths) { s_excludePaths = excludePaths; } private: - void sync(const std::vector& files, const std::vector& homeIndices, const std::vector& systemIndices, + void sync(const std::vector& paths, const std::vector& homeIndices, const std::vector& systemIndices, const std::function& generateHomePaths, const std::function& generateSystemPaths); void forEachDotfile(const std::vector& targets, const std::function& callback);