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
This commit is contained in:
Abdelrazak Younes 2008-06-09 09:34:11 +00:00
parent dbc07ef630
commit 48cd43fd51

View File

@ -463,14 +463,21 @@ void LyX::prepareExit()
// do any other cleanup procedures now // do any other cleanup procedures now
if (package().temp_dir() != package().system_temp_dir()) { if (package().temp_dir() != package().system_temp_dir()) {
LYXERR(Debug::INFO, "Deleting tmp dir " string const abs_tmpdir = package().temp_dir().absFilename();
<< package().temp_dir().absFilename()); if (!contains(package().temp_dir().absFilename(), "lyx_tmpdir")) {
if (!package().temp_dir().destroyDirectory()) {
docstring const msg = docstring const msg =
bformat(_("Unable to remove the temporary directory %1$s"), bformat(_("%1$s does not appear like a LyX created temporary directory."),
from_utf8(package().temp_dir().absFilename())); from_utf8(abs_tmpdir));
Alert::warning(_("Unable to remove temporary directory"), msg); 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);
}
} }
} }