aboutsummaryrefslogtreecommitdiff
path: root/src/add_repo.cc
blob: 3de06dc24a7591da09d6996f3b1c90c480272c8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <fstream>
#include <string>

#include "add_repo.hh"
#include "vars.hh"

void add_repo(std::string repo, std::string repo_name) {
  std::ifstream rfile(repo_file);
  std::string rfile_line;
  std::string rfile_contents;
  while (getline(rfile, rfile_line)) {
    rfile_contents += rfile_line + "\n";
  }
  rfile.close();

  std::ofstream wfile;
  wfile.open(repo_file);
  wfile << rfile_contents << "repos[\"" << repo_name << "\"] = \"" << repo << "\"" << std::endl;
  wfile.close();
}