| 55 | |
| 56 | |
| 57 | bool CmdRegistry::loadConfigFile(in_string fileName) { |
| 58 | // https://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring |
| 59 | ifstream file(fileName); |
| 60 | if (!file.is_open()) |
| 61 | { |
| 62 | file.open(std::string{ BASE_JSM_CONFIG_FOLDER() } + fileName); |
| 63 | } |
| 64 | if (file) |
| 65 | { |
| 66 | printf("Loading commands from file %s\n", fileName.c_str()); |
| 67 | // https://stackoverflow.com/questions/6892754/creating-a-simple-configuration-file-and-parser-in-c |
| 68 | string line; |
| 69 | while (getline(file, line)) { |
| 70 | processLine(line); |
| 71 | } |
| 72 | file.close(); |
| 73 | return true; |
| 74 | } |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | string_view CmdRegistry::strtrim(std::string_view str) |
| 79 | { |
no test coverage detected