ServidorTFG/config_package.cpp

20 lines
536 B
C++
Raw Normal View History

2020-05-08 12:43:46 +02:00
#include "config_package.h"
config_package::config_package(std::string name) : name(name){
this->file = std::fstream("/etc/portage/package.use/"+name, std::ifstream::in);
for(std::string line; std::getline(this->file, line);){
this->uses+=line+"\n";
}
this->file.close();
}
void config_package::change_uses(std::string remote_uses){
if(remote_uses!=this->uses){
this->file=std::fstream("/etc/portage/package.use/"+name, std::ofstream::out);
this->file << remote_uses;
this->file.close();
}
}