[LyX/master] Code cleanup: avoid repeating temp_dir method calls while local variable has a result already.

Stephan Witt switt at lyx.org
Mon Feb 17 12:06:59 UTC 2020


commit 0f1f00db273fb851104300884379b52d472cdf7a
Author: Stephan Witt <switt at lyx.org>
Date:   Mon Feb 17 13:25:35 2020 +0100

    Code cleanup: avoid repeating temp_dir method calls while local variable has a result already.
---
 src/LyX.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/LyX.cpp b/src/LyX.cpp
index 1c8af06..20c5e83 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -438,17 +438,16 @@ void LyX::prepareExit()
 	// do any other cleanup procedures now
 	if (package().temp_dir() != package().system_temp_dir()) {
 		string const abs_tmpdir = package().temp_dir().absFileName();
-		if (!contains(package().temp_dir().absFileName(), "lyx_tmpdir")) {
+		if (!contains(abs_tmpdir, "lyx_tmpdir")) {
 			docstring const 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());
+			LYXERR(Debug::INFO, "Deleting tmp dir "	<< abs_tmpdir);
 			if (!package().temp_dir().destroyDirectory()) {
 				LYXERR0(bformat(_("Unable to remove the temporary directory %1$s"),
-					from_utf8(package().temp_dir().absFileName())));
+					from_utf8(abs_tmpdir)));
 			}
 		}
 	}


More information about the lyx-cvs mailing list