From: Abdelrazak Younes Date: Mon, 9 Jun 2008 09:34:11 +0000 (+0000) Subject: First part of http://bugzilla.lyx.org/show_bug.cgi?id=4918 X-Git-Tag: 1.6.10~4444 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=48cd43fd51c0282ce07cffea1f7b473547aa102e;p=features.git First part of http://bugzilla.lyx.org/show_bug.cgi?id=4918 Prevent deletion of LyX temporary directory is this is not a LyX created directory. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25199 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/LyX.cpp b/src/LyX.cpp index ed84179346..2c8f766c72 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -463,14 +463,21 @@ void LyX::prepareExit() // do any other cleanup procedures now if (package().temp_dir() != package().system_temp_dir()) { - LYXERR(Debug::INFO, "Deleting tmp dir " - << package().temp_dir().absFilename()); - - if (!package().temp_dir().destroyDirectory()) { + string const abs_tmpdir = package().temp_dir().absFilename(); + if (!contains(package().temp_dir().absFilename(), "lyx_tmpdir")) { docstring const msg = - bformat(_("Unable to remove the temporary directory %1$s"), - from_utf8(package().temp_dir().absFilename())); - Alert::warning(_("Unable to remove temporary directory"), msg); + bformat(_("%1$s does not appear like a LyX created temporary directory."), + from_utf8(abs_tmpdir)); + Alert::warning(_("Cannot remove temporary directory"), msg); + } else { + LYXERR(Debug::INFO, "Deleting tmp dir " + << package().temp_dir().absFilename()); + if (!package().temp_dir().destroyDirectory()) { + docstring const msg = + bformat(_("Unable to remove the temporary directory %1$s"), + from_utf8(package().temp_dir().absFilename())); + Alert::warning(_("Unable to remove temporary directory"), msg); + } } }