Compare commits

...
3 Commits
2 changed files with 3 additions and 4 deletions
+2 -4
View File
@@ -64,11 +64,10 @@ void Dotfile::add(const std::vector<std::string>& targets)
for (size_t i : noExistIndices) {
fprintf(stderr, "\033[31;1mDotfile:\033[0m '%s': no such file or directory\n", targets.at(i).c_str());
}
return;
}
sync(
SyncType::Pull, targets, homeIndices, systemIndices,
SyncType::Add, targets, homeIndices, systemIndices,
[](std::string* paths, const std::string& homePath, const std::string& homeDirectory) {
paths[0] = homePath;
paths[1] = homePath.substr(homeDirectory.size() + 1);
@@ -292,9 +291,8 @@ void Dotfile::sync(SyncType type,
if (!systemIndices.empty() && !root) {
for (size_t i : systemIndices) {
fprintf(stderr, "\033[31;1mDotfile:\033[0m need root privileges to copy system file '%s'\n",
paths.at(i).c_str() + Config::the().workingDirectorySize());
paths.at(i).c_str() + (type == SyncType::Add ? 0 : Config::the().workingDirectorySize()));
}
return;
}
auto printError = [](const std::filesystem::path& path, const std::error_code& error) -> void {
+1
View File
@@ -21,6 +21,7 @@ public:
virtual ~Dotfile();
enum class SyncType {
Add,
Pull,
Push,
};