| 14 | } |
| 15 | |
| 16 | std::string sysget::GetPackageManager(std::string filename) { |
| 17 | std::string line; |
| 18 | std::string packagemanager; |
| 19 | std::ifstream file(filename); |
| 20 | |
| 21 | std::vector<std::string> PackageManagerList = sysget::GetPackageManagerList(); |
| 22 | |
| 23 | if(file.is_open()) { |
| 24 | while(getline(file, line)) { |
| 25 | // If the package manager is valid |
| 26 | if(std::find(PackageManagerList.begin(), PackageManagerList.end(), line) != PackageManagerList.end()) { |
| 27 | return line; |
| 28 | } |
| 29 | |
| 30 | else { |
| 31 | return "ERROR"; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | else { |
| 37 | std::cout << sysget::JsonSTR(lang["openconferr"]) << std::endl; |
| 38 | exit(1); |
| 39 | } |
| 40 | // clang on macOS will return a warning if a non-void function has no return |
| 41 | return "ERROR"; |
| 42 | } |
| 43 | |
| 44 | void sysget::CreateConf(std::string filename, std::string packagemanager) { |
| 45 | system("mkdir -p /etc/sysget"); |