modified the way --preprocess works.
the source folder doesn't need to be in data/ folder and all result files will be placed in the target directory.
This commit is contained in:
parent
3db682f822
commit
19b1f0a6a5
3 changed files with 12 additions and 14 deletions
|
@ -145,8 +145,12 @@ runs the game without sounds and music.
|
|||
prints the name of the game data directory and exits.
|
||||
.TP
|
||||
.B --preprocess, -p[=<define1>,<define2>,...] <file/folder> <target directory>
|
||||
preprocesses a specified file/folder relative to the data/ directory. The file(s) will be written in the data/preproc folder: a plain cfg file and a processed cfg file. The needed folder tree will be created automatically if it doesn't exist.
|
||||
define1,define2,... - the extra defines will be added before processing the files.
|
||||
preprocesses a specified file/folder. The file(s) will be written in specified target
|
||||
directory: a plain cfg file and a processed cfg file. If a folder is specified, it will
|
||||
be preprocessed recursively based on the known preprocessor rules. The common macroses
|
||||
from the data/core/macros will be preprocessed before the specified resources.
|
||||
.B define1,define2,...
|
||||
- the extra defines will be added before processing the files.
|
||||
.TP
|
||||
.BI -r\ X x Y ,\ --resolution\ X x Y
|
||||
sets the screen resolution. Example:
|
||||
|
|
13
src/game.cpp
13
src/game.cpp
|
@ -1829,11 +1829,9 @@ static int process_command_args(int argc, char** argv) {
|
|||
<< " errors unless every player uses it)\n"
|
||||
<< " --path prints the path to the data directory and exits.\n"
|
||||
<< " --preprocess, -p[=<define1>,<define2>,...] <file/folder> <target directory>\n"
|
||||
<< " preprocesses a specified file/folder relative to\n"
|
||||
<< " the data/ directory. The file(s) will be written in\n"
|
||||
<< " the specified target directory: a plain cfg file and a\n"
|
||||
<< " processed cfg file. The needed folder tree will be\n"
|
||||
<< " created automatically if it doesn't exist\n"
|
||||
<< " preprocesses a specified file/folder. The preprocessed\n"
|
||||
<< " file(s) will be written in the specified target\n"
|
||||
<< " directory: a plain cfg file and a processed cfg file.\n"
|
||||
<< " define1,define2,... - the extra defines will\n"
|
||||
<< " be added before processing the files.\n"
|
||||
<< " -r, --resolution XxY sets the screen resolution. Example: -r 800x600\n"
|
||||
|
@ -1989,11 +1987,10 @@ static int process_command_args(int argc, char** argv) {
|
|||
preprocess_resource(game_config::path + "/data/core/macros/",&defines_map);
|
||||
|
||||
LOG_PREPROC<<"processing target resource...\n";
|
||||
preprocess_resource(game_config::path +"/data/"+ resourceToProcess, &defines_map,
|
||||
true,true, targetDir);
|
||||
preprocess_resource(resourceToProcess, &defines_map, true,true, targetDir);
|
||||
}
|
||||
else{
|
||||
std::cerr<<"Please specify a source file/folder relative to the data/ directory and a target folder\n";
|
||||
std::cerr<<"Please specify a source file/folder and a target folder\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1038,10 +1038,7 @@ void preprocess_resource(const std::string res_name, preproc_map *defines_map,
|
|||
|
||||
if (write_cfg == true || write_plain_cfg == true)
|
||||
{
|
||||
std::string preproc_res_name = res_name;
|
||||
// we replace <path>/data/<resource> with <target_directory>/<resource>
|
||||
preproc_res_name.erase(0,preproc_res_name.find("/data")+5);
|
||||
preproc_res_name.insert(0,target_directory);
|
||||
const std::string preproc_res_name = target_directory + "/" + file_name(res_name);
|
||||
|
||||
// write the processed cfg file
|
||||
if (write_cfg == true)
|
||||
|
|
Loading…
Add table
Reference in a new issue