mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Quote shell variables in generated graphics conversion script.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9028 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
915304d550
commit
cc179cc2a2
@ -1,3 +1,8 @@
|
||||
2004-10-01 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GraphicsConverter.C (move_file, build_script): protect
|
||||
shell variables with quotes.
|
||||
|
||||
2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* pch.h: use proper signal include
|
||||
|
@ -256,13 +256,13 @@ string const move_file(string const & from_file, string const & to_file)
|
||||
ostringstream command;
|
||||
command << "fromfile=" << from_file << "\n"
|
||||
<< "tofile=" << to_file << "\n\n"
|
||||
<< "'mv' -f ${fromfile} ${tofile} ||\n"
|
||||
<< "'mv' -f \"${fromfile}\" \"${tofile}\" ||\n"
|
||||
<< "{\n"
|
||||
<< "\t'cp' -f ${fromfile} ${tofile} ||\n"
|
||||
<< "\t'cp' -f \"${fromfile}\" \"${tofile}\" ||\n"
|
||||
<< "\t{\n"
|
||||
<< "\t\texit 1\n"
|
||||
<< "\t}\n"
|
||||
<< "\t'rm' -f ${fromfile}\n"
|
||||
<< "\t'rm' -f \"${fromfile}\"\n"
|
||||
<< "}\n";
|
||||
|
||||
return command.str();
|
||||
@ -328,9 +328,9 @@ bool build_script(string const & from_file,
|
||||
<< "outfile=" << QuoteName(outfile) << '\n';
|
||||
|
||||
string command = conv.command;
|
||||
command = subst(command, token_from, "${infile}");
|
||||
command = subst(command, token_base, "${infile_base}");
|
||||
command = subst(command, token_to, "${outfile}");
|
||||
command = subst(command, token_from, "\"${infile}\"");
|
||||
command = subst(command, token_base, "\"${infile_base}\"");
|
||||
command = subst(command, token_to, "\"${outfile}\"");
|
||||
command = LibScriptSearch(command);
|
||||
|
||||
// Store in the shell script
|
||||
@ -339,7 +339,7 @@ bool build_script(string const & from_file,
|
||||
// Test that this was successful. If not, remove
|
||||
// ${outfile} and exit the shell script
|
||||
script << "{\n"
|
||||
<< "\t'rm' -f ${outfile}\n"
|
||||
<< "\t'rm' -f \"${outfile}\"\n"
|
||||
<< "\texit 1\n"
|
||||
<< "}\n\n";
|
||||
|
||||
@ -348,10 +348,10 @@ bool build_script(string const & from_file,
|
||||
// ${outfile}.1.
|
||||
// If this occurs, move ${outfile}.0 to ${outfile}
|
||||
// and delete ${outfile}.?
|
||||
script << "if [ ! -f ${outfile} ]; then\n"
|
||||
<< "\tif [ -f ${outfile}.0 ]; then\n"
|
||||
<< "\t\t'mv' -f ${outfile}.0 ${outfile}\n"
|
||||
<< "\t\t'rm' -f ${outfile}.?\n"
|
||||
script << "if [ ! -f \"${outfile}\" ]; then\n"
|
||||
<< "\tif [ -f \"${outfile}\".0 ]; then\n"
|
||||
<< "\t\t'mv' -f \"${outfile}\".0 \"${outfile}\"\n"
|
||||
<< "\t\t'rm' -f \"${outfile}\".?\n"
|
||||
<< "\telse\n"
|
||||
<< "\t\texit 1\n"
|
||||
<< "\tfi\n"
|
||||
@ -359,12 +359,12 @@ bool build_script(string const & from_file,
|
||||
|
||||
// Delete the infile, if it isn't the original, from_file.
|
||||
if (infile != from_file) {
|
||||
script << "'rm' -f ${infile}\n\n";
|
||||
script << "'rm' -f \"${infile}\"\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Move the final outfile to to_file
|
||||
script << move_file("${outfile}", QuoteName(to_file));
|
||||
script << move_file("\"${outfile}\"", QuoteName(to_file));
|
||||
lyxerr[Debug::GRAPHICS] << "ready!" << endl;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user