MCPcopy Create free account
hub / github.com/cvengler/sysget / GetPackageManager

Method GetPackageManager

src/utils.cpp:16–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16std::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
44void sysget::CreateConf(std::string filename, std::string packagemanager) {
45 system("mkdir -p /etc/sysget");

Callers

nothing calls this directly

Calls 3

findFunction · 0.85
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected