From 65f9fc786e040d9288e6e868ce6a41e89f6e50f9 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 19 May 2005 08:43:52 +0000 Subject: [PATCH] Enable lyx2lyx to work with "file names with spaces". git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9954 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/ChangeLog | 11 ++++++++--- lib/lyx2lyx/lyx2lyx | 1 + src/ChangeLog | 4 ++++ src/buffer.C | 21 ++++++++++++--------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 48525fe827..f67ced34c6 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,8 @@ +2005-05-18 Angus Leeming + + * lyx2lyx (parse_options): Add the description of the '-f' option + back again. + 2005-05-18 Georg Baum * lyx_1_4.py (convert_breaks): Don't treat every token that starts @@ -5,7 +10,8 @@ 2005-05-06 José Matos - * lyx_1_4.py (convert_breaks): put all paragraph parameters into a single line. + * lyx_1_4.py (convert_breaks): put all paragraph parameters into a + single line. 2005-05-04 José Matos @@ -257,7 +263,7 @@ * lyx_1_4.py (convert_frameless_box): Replace instead of adding new code. -. + 2004-04-14 José Matos * error.py @@ -416,4 +422,3 @@ * lyxconvert_223.py: * lyxconvert_224.py (convert_minipage): move funtion to its right place. (convert_breaks): convert line and page break, at bottom and top. - diff --git a/lib/lyx2lyx/lyx2lyx b/lib/lyx2lyx/lyx2lyx index f355240b55..7e27f056ed 100755 --- a/lib/lyx2lyx/lyx2lyx +++ b/lib/lyx2lyx/lyx2lyx @@ -32,6 +32,7 @@ Options: -d, --debug level level=0..2 (O_ no debug information, 2_verbose) default: level=1 -e, --err error_file name of the error file or else goes to stderr + -f, --from version initial version (optional) -t, --to version final version (optional) -o, --output name name of the output file or else goes to stdout -q, --quiet same as --debug=0""" diff --git a/src/ChangeLog b/src/ChangeLog index b1634c3364..a459de5298 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-05-18 Angus Leeming + + * buffer.C (readFile): Quote all file names passed to lyx2lyx. + 2005-05-12 Martin Vermeer * tabular.[hC]: added setCellInset to fix tabular paste. diff --git a/src/buffer.C b/src/buffer.C index 90cc72c46f..ca87c4c425 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -638,9 +638,8 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type const pit) filename)); return false; } - string command = - "python " + LibFileSearch("lyx2lyx", "lyx2lyx"); - if (command.empty()) { + string const lyx2lyx = LibFileSearch("lyx2lyx", "lyx2lyx"); + if (lyx2lyx.empty()) { Alert::error(_("Conversion script not found"), bformat(_("%1$s is from an earlier" " version of LyX, but the" @@ -649,14 +648,18 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type const pit) filename)); return false; } - command += " -t" - + convert(LYX_FORMAT) - + " -o " + tmpfile + ' ' - + QuoteName(filename); + ostringstream command; + command << "python " << QuoteName(lyx2lyx) + << " -t " << convert(LYX_FORMAT) + << " -o " << QuoteName(tmpfile) << ' ' + << QuoteName(filename); + string const command_str = command.str(); + lyxerr[Debug::INFO] << "Running '" - << command << '\'' + << command_str << '\'' << endl; - cmd_ret const ret = RunCommand(command); + + cmd_ret const ret = RunCommand(command_str); if (ret.first != 0) { Alert::error(_("Conversion script failed"), bformat(_("%1$s is from an earlier version"