refactor(tree): give the history, the archive and the self-update a folder
Three self-contained things shared src/ with the rest: the operation history, the zip reader behind the .fwspacm installer, and the self-update. Each moves to its own folder — history/, archive/ and update/ — so a change to one does not have to reason about the others.
This commit is contained in:
7 files changed
+30
-30
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
struct HistoryEntry {
|
||||
std::string timestamp;
|
||||
std::string action; // "install", "remove", "update"
|
||||
std::string package;
|
||||
std::string plugin;
|
||||
bool success;
|
||||
};
|
||||
|
||||
class HistoryManager {
|
||||
public:
|
||||
HistoryManager(const std::string& historyFile = "~/.local/share/PacManager/history.csv");
|
||||
~HistoryManager();
|
||||
|
||||
void record(const HistoryEntry& entry);
|
||||
const std::vector<HistoryEntry>& getHistory() const;
|
||||
void clear();
|
||||
void save();
|
||||
void load();
|
||||
|
||||
private:
|
||||
std::string m_historyFile;
|
||||
std::vector<HistoryEntry> m_history;
|
||||
|
||||
std::string expandPath(const std::string& path);
|
||||
std::string getCurrentTimestamp();
|
||||
};
|
||||
Reference in new issue
Block a user