36 std::ofstream tmp_file(cache);
37 std::ifstream main_file;
44 while (std::getline(main_file, line)) {
46 while (line.find(token) != std::string::npos) {
47 line.replace(line.find(token), token.size(), data);
50 tmp_file << line <<
"\n";
72 std::ofstream tmp_file(cache);
73 std::ifstream main_file;
80 while (std::getline(main_file, line)) {
82 if (var_type == std::string(
"define"))
85 if ((line.find(var_type) != std::string::npos) &&
86 (line.find(var_name) != std::string::npos)) {
88 std::string prefix = line.substr(0, line.find(var_type));
90 std::string postfix =
"";
91 if (var_name != std::string(
"#define")) {
92 postfix = line.substr(line.find(
";"), line.size() - 1);
96 if (var_type == std::string(
"#define")) {
97 var =
"#define " + var_name +
" " + data;
99 var = var_type +
" " + var_name +
" = " + data;
102 line = prefix + var + postfix;
105 tmp_file << line <<
"\n";
119 while (in.find(
"/") != std::string::npos) {
120 in.replace(in.find(
"/"), std::string(
"/").size(),
".");
#define CBUILD_COPY_CACHE_DIR
tmp dir in cache dir
#define CBUILD_CACHE_DIR
Cache directory of CBuild.
bool create(std::vector< std::string > paths, CBuild::fs::type what)
Create element.
bool remove(std::string path, bool force=false)
Delete files or directories.
int set_var(std::string file, std::string var_type, std::string var_name, std::string data)
Set value of variable with type var_type wth name var_name to data This function loocks for variable ...
std::string path_to_file(std::string in)
Convert path to filename by replacing '\' by '.'.
int replace(std::string file, std::string token, std::string data)
Replace [token] by [data] in [file].
bool move(std::string start, std::string end)
Move files or directories, remove starting files or directories.