config: restore configCurrenPath after sourcing file (#3339)

This commit is contained in:
Legorel 2023-09-25 00:11:34 +02:00 committed by GitHub
parent 46d66f4bcc
commit 6bdc45e9ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1239,6 +1239,8 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
std::string line = "";
int linenum = 1;
if (ifs.is_open()) {
auto configCurrentPathBackup = configCurrentPath;
while (std::getline(ifs, line)) {
// Read line by line.
try {
@ -1259,6 +1261,8 @@ void CConfigManager::handleSource(const std::string& command, const std::string&
}
ifs.close();
configCurrentPath = configCurrentPathBackup;
}
}
}