| 409 | } |
| 410 | |
| 411 | void Configuration::removeFolder(std::unordered_map<u64, std::vector<std::string>>& map, const char* key, u64 id, const std::string& path) |
| 412 | { |
| 413 | auto it = map.find(id); |
| 414 | if (it == map.end()) { |
| 415 | return; |
| 416 | } |
| 417 | auto& folders = it->second; |
| 418 | folders.erase(std::remove(folders.begin(), folders.end(), path), folders.end()); |
| 419 | if (folders.empty()) { |
| 420 | map.erase(it); |
| 421 | mJson[key].erase(hexId(id)); |
| 422 | } |
| 423 | else { |
| 424 | mJson[key][hexId(id)]["folders"] = folders; |
| 425 | } |
| 426 | save(); |
| 427 | } |
| 428 | |
| 429 | void Configuration::addAdditionalSaveFolder(u64 id, const std::string& path) |
| 430 | { |