30 lines
710 B
C++
30 lines
710 B
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
struct Project
|
|
{
|
|
std::string name;
|
|
std::string path;
|
|
};
|
|
|
|
class ProjectManager
|
|
{
|
|
public:
|
|
ProjectManager();
|
|
~ProjectManager();
|
|
|
|
const std::vector<Project> &getProjects() const;
|
|
void addProject(const std::string &name, const std::string &path);
|
|
void deleteProject(size_t index);
|
|
void editProject(size_t index, const std::string &name, const std::string &path);
|
|
bool openProject(size_t index);
|
|
|
|
private:
|
|
std::vector<Project> projects;
|
|
const std::string CONFIG_FILE = std::string(getenv("HOME")) + "/.config/project-launcher/projects.json";
|
|
|
|
void saveToFile();
|
|
void loadFromFile();
|
|
}; |