Customisable backup directory.

This commit is contained in:
Your Name
2025-04-25 23:52:08 +12:00
parent 3c99ad1503
commit fa7236b4f5
7 changed files with 51 additions and 17 deletions

View File

@ -36,7 +36,7 @@ bool envmanager::load() {
std::string value = line.substr(pos + 1);
// trim whitespace from the key and value
m_variables[trim(key)] = trim(value);
m_variables[dequote(trim(key))] = dequote(trim(value));
}
}
file.close();
@ -50,13 +50,13 @@ void envmanager::save() {
}
for (const auto& pair : m_variables) {
file << pair.first << "=" << pair.second << std::endl;
file << pair.first << "=" << quote(pair.second) << std::endl;
}
file.close();
}
std::string envmanager::get_variable(std::string key) const {
key = trim(key);
key = dequote(trim(key));
// Use case-insensitive comparison to find the key
for (const auto& pair : m_variables) {
@ -91,7 +91,7 @@ void envmanager::add_variables(std::map<std::string, std::string> variables) {
}
void envmanager::set_variable(std::string key, std::string value) {
m_variables[trim(key)] = trim(value);
m_variables[dequote(trim(key))] = dequote(trim(value));
}
void envmanager::clear_variables() {
@ -115,7 +115,8 @@ std::string envmanager::expand_patterns(std::string str) const {
result = result.replace(match.position(), match.length(), value);
}
// dequote the result
return result;
}