[VPUX] Updated config's parser (#7974)

Updated config's parser for compile_tool
The parser can read value containing spaces
This commit is contained in:
Aleksei Kruglov 2021-11-03 12:14:13 +03:00 committed by GitHub
parent ece45630f0
commit 4e4e179d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,12 +158,18 @@ static std::map<std::string, std::string> parseConfigFile(char comment = '#') {
std::ifstream file(FLAGS_c);
if (file.is_open()) {
std::string key, value;
while (file >> key >> value) {
if (key.empty() || key[0] == comment) {
std::string option;
while (std::getline(file, option)) {
if (option.empty() || option[0] == comment) {
continue;
}
config[key] = value;
size_t spacePos = option.find(' ');
std::string key, value;
if (spacePos != std::string::npos) {
key = option.substr(0, spacePos);
value = option.substr(spacePos + 1);
config[key] = value;
}
}
}
return config;