Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help with new Chromium API for File Access. need to read in a text-file and split some strings (config: key=value) can some body help me with the API? need to refactor one single function #361

Open
Arthur-Senior opened this issue Jun 16, 2024 · 0 comments

Comments

@Arthur-Senior
Copy link

Arthur-Senior commented Jun 16, 2024

void Singleton::readConfigFile() {
  std::string delimiter = "=";
  std::string line;
  std::ifstream configFileStream(this->configFile);

  if (configFileStream.is_open()) {
    while (getline(configFileStream, line)) {
      std::vector<std::string> v = split(line, delimiter);
      if (v.size() == 2) {
        configMap[v[0]] =
            v[1];  // Insert the key-value pair into the global configMap
      }
    }
    configFileStream.close();
  } else {
    // Handle file open error
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant