2017-03-13 19:03:07 -07:00
|
|
|
#ifndef __BOTTLES_HPP
|
|
|
|
#define __BOTTLES_HPP
|
|
|
|
#pragma once
|
|
|
|
|
2017-03-22 19:02:14 -07:00
|
|
|
#include <map>
|
2017-03-13 19:03:07 -07:00
|
|
|
#include <string>
|
|
|
|
|
2017-03-23 12:06:29 -07:00
|
|
|
#include "commands.hpp"
|
2018-03-13 20:06:15 -07:00
|
|
|
#include "nlohmann/json.hpp"
|
2017-03-22 19:02:14 -07:00
|
|
|
|
2017-03-13 19:03:07 -07:00
|
|
|
using namespace std;
|
|
|
|
|
2017-03-22 19:02:14 -07:00
|
|
|
using json = nlohmann::json;
|
|
|
|
|
2017-03-13 19:03:07 -07:00
|
|
|
namespace cellar {
|
|
|
|
namespace bottles {
|
2017-03-22 19:02:14 -07:00
|
|
|
enum bottle_type {
|
|
|
|
bottle_error,
|
|
|
|
bottle_anonymous,
|
|
|
|
bottle_labelled,
|
2025-02-03 17:50:33 -08:00
|
|
|
bottle_symlink,
|
|
|
|
bottle_steam
|
2017-03-22 19:02:14 -07:00
|
|
|
};
|
2025-02-03 17:28:18 -08:00
|
|
|
|
2025-02-03 18:50:02 -08:00
|
|
|
enum bottle_manager {
|
|
|
|
manager_error,
|
|
|
|
manager_cellar,
|
|
|
|
manager_steam
|
|
|
|
};
|
|
|
|
|
|
|
|
extern std::string bottle_home;
|
|
|
|
|
2025-02-03 17:28:18 -08:00
|
|
|
/**
|
|
|
|
* Bottles are the internal name for WINE prefixes. In addition to standard WINE contents,
|
|
|
|
* bottles contain a configuration file managed by cellar, which labels the bottle as well
|
|
|
|
* as providing configuration settings.
|
|
|
|
*/
|
2017-03-22 19:02:14 -07:00
|
|
|
class Bottle {
|
|
|
|
public:
|
2017-03-24 17:58:24 -07:00
|
|
|
// public members
|
2017-03-22 19:02:14 -07:00
|
|
|
bottle_type type;
|
2025-02-03 18:50:02 -08:00
|
|
|
bottle_manager manager;
|
2017-03-22 19:02:14 -07:00
|
|
|
json config;
|
|
|
|
string path;
|
|
|
|
string canonical_path;
|
2017-03-24 17:58:24 -07:00
|
|
|
|
|
|
|
// constructors
|
2017-03-22 19:02:14 -07:00
|
|
|
Bottle();
|
2017-03-24 17:58:24 -07:00
|
|
|
Bottle(string);
|
|
|
|
|
|
|
|
// methods
|
2017-03-24 17:17:43 -07:00
|
|
|
bool load_config();
|
|
|
|
bool save_config();
|
2017-03-24 17:58:24 -07:00
|
|
|
string get_config(string);
|
|
|
|
bool set_config(string, string);
|
2017-03-22 19:02:14 -07:00
|
|
|
};
|
2017-03-28 12:41:25 -07:00
|
|
|
|
|
|
|
extern Bottle active_bottle;
|
|
|
|
|
2017-03-23 12:06:29 -07:00
|
|
|
extern map<string, Bottle> get_bottles();
|
2017-03-28 12:41:25 -07:00
|
|
|
extern string resolve_bottle(string);
|
|
|
|
|
|
|
|
extern void cork(string, bool);
|
|
|
|
extern void press(string, vector<string>, bool);
|
|
|
|
extern void uncork(string);
|
2017-03-13 19:03:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __BOTTLES_HPP
|