Enable lyx2lyx to work with "file names with spaces".

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-05-19 08:42:41 +00:00
parent 3ab899225b
commit c47e013abf
2 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2005-05-18 Angus Leeming <leeming@lyx.org>
* buffer.C (readFile): Quote all file names passed to lyx2lyx.
2005-05-09 Angus Leeming <leeming@lyx.org> 2005-05-09 Angus Leeming <leeming@lyx.org>
* Makefile.am: make compilation of pspell.[Ch] and ispell.[Ch] dependent * Makefile.am: make compilation of pspell.[Ch] and ispell.[Ch] dependent

View File

@ -1221,22 +1221,25 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, Paragraph * par)
"Use LyX 0.10.x to read this!")); "Use LyX 0.10.x to read this!"));
return false; return false;
} else if (!filename.empty()) { } else if (!filename.empty()) {
string command = "python " + string const lyx2lyx = LibFileSearch("lyx2lyx", "lyx2lyx");
LibFileSearch("lyx2lyx", "lyx2lyx"); if (lyx2lyx.empty()) {
if (command.empty()) {
Alert::alert(_("ERROR!"), Alert::alert(_("ERROR!"),
_("Can't find conversion script.")); _("Can't find conversion script."));
return false; return false;
} }
string const tmpfile = lyx::tempName(); string const tmpfile = lyx::tempName();
command += " -t" ostringstream command;
+ tostr(LYX_FORMAT) command << "python " << QuoteName(lyx2lyx)
+ " -o " + tmpfile + ' ' << " -t " << tostr(LYX_FORMAT)
+ QuoteName(filename); << " -o " << QuoteName(tmpfile) << ' '
<< QuoteName(filename);
string const command_str = STRCONV(command.str());
lyxerr[Debug::INFO] << "Running '" lyxerr[Debug::INFO] << "Running '"
<< command << '\'' << command_str << '\''
<< endl; << endl;
cmd_ret const ret = RunCommand(command);
cmd_ret const ret = RunCommand(command_str);
if (ret.first) { if (ret.first) {
Alert::alert(_("ERROR!"), Alert::alert(_("ERROR!"),
_("An error occured while " _("An error occured while "