From c57cee5ca6320e047669db628c3de219d6449fea Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Wed, 23 Mar 2016 14:59:49 +0100 Subject: [PATCH] create_work: use file_name as open_name when copy_file is set If no open_name is specified in a file_ref element of the input template but copy_file is set for this file use the physical filename as logical filename. --- tools/process_input_template.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/process_input_template.cpp b/tools/process_input_template.cpp index 260993bc71..b985ec58f1 100644 --- a/tools/process_input_template.cpp +++ b/tools/process_input_template.cpp @@ -363,7 +363,7 @@ static int process_workunit( break; } else if (xp.match_tag("file_ref")) { out += "\n"; - bool found_file_number = false, found_open_name = false; + bool found_file_number = false, found_open_name = false, found_copy_file = false; while (!xp.get_tag()) { if (xp.parse_int("file_number", file_number)) { INFILE_DESC& id = infiles[file_number]; @@ -384,14 +384,26 @@ static int process_workunit( out += buf; found_open_name = true; continue; + } else if (xp.match_tag("copy_file/")) { + out += " \n"; + found_copy_file = true; + continue; } else if (xp.match_tag("/file_ref")) { if (!found_file_number) { fprintf(stderr, "No file number found\n"); return ERR_XML_PARSE; } - if (!found_open_name) { - fprintf(stderr, "No open name found\n"); + if (!found_open_name && !found_copy_file) { + fprintf(stderr, "No open name found and copy_file not specified\n"); return ERR_XML_PARSE; + } else if (!found_open_name && found_copy_file) { + INFILE_DESC& id = infiles[file_number]; + if (id.is_remote) { + sprintf(buf, " jf_%s\n", infiles[file_number].md5); + } else { + sprintf(buf, " %s\n", infiles[file_number].name); + } + out += buf; } out += "\n"; break;