Implicitly redirect cmdhelp includes to corresponding JSON files
This should help with the superfluous building due to cmdhelp.
This commit is contained in:
parent
c86f10376a
commit
5f8f8af25f
1 changed files with 19 additions and 1 deletions
|
@ -9,9 +9,27 @@
|
|||
|
||||
namespace boost_fs = boost::filesystem;
|
||||
|
||||
std::string search_include(const std::list<std::string>& searchpath, const std::string& filename,
|
||||
bool is_cmdhelp_file(const std::string& filename)
|
||||
{
|
||||
std::string _filename = filename;
|
||||
return (_filename.length() > 8 && _filename.substr(0, 8) == "cmdhelp/");
|
||||
}
|
||||
|
||||
std::string search_include(const std::list<std::string>& searchpath, const std::string& _filename,
|
||||
const std::string& ref_by)
|
||||
{
|
||||
std::string filename = _filename;
|
||||
//Hack: process cmdhelp includes internally as the date were for the JSON include.
|
||||
if(is_cmdhelp_file(filename)) {
|
||||
if(filename != "cmdhelp/inverselist.hpp") {
|
||||
filename = "../src/" + filename;
|
||||
//Replace the extension with .json.
|
||||
size_t split = filename.find_last_of("./\\");
|
||||
if(split < filename.length() && filename[split] == '.') {
|
||||
filename = filename.substr(0, split) + ".json";
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t p = ref_by.find_last_of("/");
|
||||
if(p < ref_by.length()) {
|
||||
std::string i = ref_by;
|
||||
|
|
Loading…
Add table
Reference in a new issue