// SPDX-License-Identifier: MPL-2.0 #include "vybuild.hpp" #include using namespace std; namespace fs=filesystem; string vybuild::parser::root_folder_parsing(const string& root_folder,const string& file) { if (root_folder=="%filefolder%") { return fs::absolute(fs::path(file)).parent_path().string(); } else if (root_folder=="%rootcallerfolder%") { return fs::absolute(vybuild::vars::get_global_variable("%rootcallerfolder%")).string(); } else { return file; } } vector vybuild::parser::vector_string_vars(vector vector_in) { vector out; for (auto arg:vector_in) { auto element=arg; for (auto var:vybuild::vars::get_global_variables_list()) { regex regvar(var); arg=regex_replace(arg,regvar,vybuild::vars::get_global_variable(var)); } out.push_back(arg); } return out; } string vybuild::parser::string_vars(string string_in) { string out=string_in; for (auto var:vybuild::vars::get_global_variables_list()) { regex regvar(var); out=regex_replace(out,regvar,vybuild::vars::get_global_variable(var)); } return out; } vector vybuild::parser::vector_string_path_completions(vector vector_in,string suffix) { vector out; for (int i=0;i