Customisable backup directory.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user