Preprocessor: allow wesnoth --preprocess to work on files without the .cfg extension
The changed function is only called when using --preprocess, but calls itself recursively. This moves the filename filter to be around the recursive call, thus skipping the check for the top-level call.
This commit is contained in:
parent
d81a15ed33
commit
85a3f8a2df
2 changed files with 5 additions and 6 deletions
2
changelog_entries/preprocess_non_cfg.md
Normal file
2
changelog_entries/preprocess_non_cfg.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
### Miscellaneous and Bug Fixes
|
||||
* The command line `--preprocess` utility now accepts any filename, not just those ending .cfg.
|
|
@ -1770,17 +1770,14 @@ void preprocess_resource(const std::string& res_name,
|
|||
|
||||
// Files in current directory
|
||||
for(const std::string& file : files) {
|
||||
preprocess_resource(file, defines_map, write_cfg, write_plain_cfg, parent_directory);
|
||||
if(filesystem::ends_with(file, ".cfg")) {
|
||||
preprocess_resource(file, defines_map, write_cfg, write_plain_cfg, parent_directory);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// process only config files.
|
||||
if(!filesystem::ends_with(res_name, ".cfg")) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_PREPROC << "processing resource: " << res_name;
|
||||
|
||||
// disable filename encoding to get clear #line in cfg.plain
|
||||
|
|
Loading…
Add table
Reference in a new issue