From 61e89e29e1a48678b9b22a9585f7e7ee3e8fc1d8 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 7 Mar 2002 16:03:36 +0000 Subject: [PATCH] fix uninitialized variable in insetexternal; espace ~ in \input@path git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3694 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/POTFILES.in | 1 - src/ChangeLog | 12 ++++++++++++ src/buffer.C | 23 +++++++++++++++++------ src/insets/ChangeLog | 5 +++++ src/insets/insetexternal.C | 2 +- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index c1a60601a2..b4eca29180 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,7 +9,6 @@ src/converter.C src/CutAndPaste.C src/debug.C src/exporter.C -src/ext_l10n.h src/FontLoader.C src/frontends/controllers/biblio.C src/frontends/controllers/ButtonController.h diff --git a/src/ChangeLog b/src/ChangeLog index 321ef7ff1e..b4746c396a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2002-03-07 Jean-Marc Lasgouttes + + * buffer.C (Buffer): initialize niceFile to true + (makeLaTeXFile): + (makeLinuxDocFile): + (makeDocBookFile): make sure niceFile is true on exit + +2002-03-06 Jean-Marc Lasgouttes + + * buffer.C (makeLaTeXFile): escape ~ in \input@path + 2002-03-07 Angus Leeming * LyXSendto.C: remove. @@ -11,6 +22,7 @@ * undo_funcs.C (textHandleUndo): fix problems when the paragraph got moved away with the DEPM and also set the inset_owner always right which before could have been omitted. + 2002-03-07 Lars Gullik Bjønnes * buffer.C (parseSingleLyXformat2Token): use default layout is the diff --git a/src/buffer.C b/src/buffer.C index 0418de62e1..8c82692074 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -145,7 +145,7 @@ extern int tex_code_break_column; Buffer::Buffer(string const & file, bool ronly) - : paragraph(0), lyx_clean(true), bak_clean(true), + : paragraph(0), niceFile(true), lyx_clean(true), bak_clean(true), unnamed(false), dep_clean(0), read_only(ronly), filename_(file), users(0) { @@ -2037,16 +2037,16 @@ void Buffer::makeLaTeXFile(string const & fname, { lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl; - niceFile = nice; // this will be used by Insetincludes. - - tex_code_break_column = lyxrc.ascii_linelen; - ofstream ofs(fname.c_str()); if (!ofs) { Alert::err_alert(_("Error: Cannot open file: "), fname); return; } + niceFile = nice; // this will be used by Insetincludes. + + tex_code_break_column = lyxrc.ascii_linelen; + // validate the buffer. lyxerr[Debug::LATEX] << " Validating buffer..." << endl; LaTeXFeatures features(params); @@ -2084,9 +2084,11 @@ void Buffer::makeLaTeXFile(string const & fname, texrow.newline(); } if (!original_path.empty()) { + string inputpath = os::external_path(original_path); + subst(inputpath, "~", "\\string~"); ofs << "\\makeatletter\n" << "\\def\\input@path{{" - << os::external_path(original_path) << "/}}\n" + << inputpath << "/}}\n" << "\\makeatother\n"; texrow.newline(); texrow.newline(); @@ -2519,6 +2521,9 @@ void Buffer::makeLaTeXFile(string const & fname, lyxerr[Debug::INFO] << "Finished making latex file." << endl; lyxerr[Debug::INFO] << "Row count was " << texrow.rows()-1 << "." << endl; + + // we want this to be true outside previews (for insetexternal) + niceFile = true; } @@ -2802,6 +2807,9 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) ofs.close(); // How to check for successful close + + // we want this to be true outside previews (for insetexternal) + niceFile = true; } @@ -3362,6 +3370,9 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) ofs.close(); // How to check for successful close + + // we want this to be true outside previews (for insetexternal) + niceFile = true; } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 77660683dd..d127886555 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-03-06 Jean-Marc Lasgouttes + + * insetexternal.C (doSubstitution): check whether we are using a + temp dir for defining $$FPath + 2002-03-07 Angus Leeming * insettabular.C: diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index ec90471852..760fa04a21 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -235,7 +235,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer, string result; string const basename = ChangeExtension(params_.filename, string()); string filepath; - if (buffer && (!buffer->niceFile)) { + if (buffer && !buffer->tmppath.empty() && !buffer->niceFile) { filepath = buffer->filePath(); } result = subst(s, "$$FName", params_.filename);